mirror of
https://github.com/mtan93/homeassistant-addons.git
synced 2026-04-14 22:05:07 +01:00
Update github actions and add version-updater script
This commit is contained in:
@@ -1,19 +0,0 @@
|
|||||||
name: eufy-ha-mqtt-bridge-release-trigger
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
repository_dispatch:
|
|
||||||
types: [createMR]
|
|
||||||
jobs:
|
|
||||||
createMR:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- run: 'sed -i "s|\"version\": \".*$|\"version\": \"${{ github.event.client_payload.version }}\",|" eufy-ha-mqtt-bridge/config.json'
|
|
||||||
- run: 'sed -i "s|VERSION=.*$|VERSION=${{ github.event.client_payload.version }}|" eufy-ha-mqtt-bridge/Dockerfile-real'
|
|
||||||
- run: sed -i "2 a $(head -n3 eufy-ha-mqtt-bridge/CHANGELOG.md | tail -n1 | perl -pe 's/(\d+\.)(\d+)(.*)/$1.($2+1).".0]"/e') - $(date +%Y-%m-%d)" eufy-ha-mqtt-bridge/CHANGELOG.md
|
|
||||||
- run: sed -i "3 a - Update \`eufy-ha-mqtt-bridge\` to \`${{ github.event.client_payload.version }}\` [Changelog](https://github.com/matijse/eufy-ha-mqtt-bridge/releases)\n" eufy-ha-mqtt-bridge/CHANGELOG.md
|
|
||||||
- name: Create Pull Request
|
|
||||||
uses: peter-evans/create-pull-request@v3
|
|
||||||
with:
|
|
||||||
title: Update eufy-mqtt-ha-bridge to version ${{ github.event.client_payload.version }}
|
|
||||||
53
.github/workflows/eufy_create_mr_and_build_image.yaml
vendored
Normal file
53
.github/workflows/eufy_create_mr_and_build_image.yaml
vendored
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
name: eufy_create_mr_and_build_image
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
create_mr_and_build_image:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- run: cd eufy-ha-mqtt-bridge && ./version-updater.sh
|
||||||
|
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v3
|
||||||
|
with:
|
||||||
|
title: Update eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }}
|
||||||
|
commit-message: Update eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }}
|
||||||
|
committer: Max Winterstein <MaxWinterstein@users.noreply.github.com>
|
||||||
|
author: Max Winterstein <MaxWinterstein@users.noreply.github.com>
|
||||||
|
assignees: MaxWinterstein
|
||||||
|
body: |
|
||||||
|
Update report
|
||||||
|
- Update related files of eufy-mqtt-ha-bridge to version ${{ env.MQTT_BRIDGE_VERSION }} [Changelog][1]
|
||||||
|
- Build docker image, check [DockerHub][2]
|
||||||
|
|
||||||
|
[1]: https://github.com/matijse/eufy-ha-mqtt-bridge/releases
|
||||||
|
[2]: https://hub.docker.com/r/maxwinterstein/homeassistant-addon-eufy-ha-mqtt-bridge
|
||||||
|
if: ${{ env.CONTINUE }}
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
if: ${{ env.CONTINUE }}
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
if: ${{ env.CONTINUE }}
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
if: ${{ env.CONTINUE }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: eufy-ha-mqtt-bridge/
|
||||||
|
file: eufy-ha-mqtt-bridge/Dockerfile-real
|
||||||
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
maxwinterstein/homeassistant-addon-eufy-ha-mqtt-bridge:${{ env.ADDON_NEXT_VERSION }}
|
||||||
|
if: ${{ env.CONTINUE }}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: eufy-ha-mqtt-bridge
|
name: eufy_manually_build_image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
# Allows you to run this workflow manually from the Actions tab
|
||||||
26
eufy-ha-mqtt-bridge/version-updater.sh
Executable file
26
eufy-ha-mqtt-bridge/version-updater.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
echo "Fetching eufy-ha-mqtt-bridge version"
|
||||||
|
MQTT_BRIDGE_VERSION=$(curl -s https://api.github.com/repos/matijse/eufy-ha-mqtt-bridge/releases/latest | grep tag_name | cut -d : -f 2,3 | tr -d \" | tr -d ',' | tr -d ' ')
|
||||||
|
echo "Newest version of eufy-ha-mqtt-bridge: $MQTT_BRIDGE_VERSION"
|
||||||
|
echo "MQTT_BRIDGE_VERSION=$MQTT_BRIDGE_VERSION" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
echo "Check if $MQTT_BRIDGE_VERSION is already used..."
|
||||||
|
grep "ARG VERSION=${MQTT_BRIDGE_VERSION}" Dockerfile-real && { echo "Version is the same, nothing to do"; exit 0; } || echo "Version is different, will continue..."
|
||||||
|
echo "CONTINUE=true" >> $GITHUB_ENV;
|
||||||
|
|
||||||
|
echo "Reading current addon version"
|
||||||
|
ADDON_CURR_VERSION=$(grep version config.json | cut -d '"' -f 4)
|
||||||
|
ADDON_NEXT_VERSION=$(echo $ADDON_CURR_VERSION| perl -pe 's/(\d+\.)(\d+)(.*)/$1.($2+1).".0"/e')
|
||||||
|
echo "ADDON_NEXT_VERSION=$ADDON_NEXT_VERSION" >> $GITHUB_ENV
|
||||||
|
echo "Update config..."
|
||||||
|
sed -i.bak "s|\ \ \"version\": \".*$|\ \ \"version\": \"$ADDON_NEXT_VERSION\",|" config.json
|
||||||
|
|
||||||
|
echo "Update Dockerfile..."
|
||||||
|
sed -i.bak "s|eufy-ha-mqtt-bridge:.*$|eufy-ha-mqtt-bridge:${ADDON_NEXT_VERSION}|" Dockerfile
|
||||||
|
sed -i.bak "s|VERSION=.*$|VERSION=${MQTT_BRIDGE_VERSION}|" Dockerfile-real
|
||||||
|
|
||||||
|
echo "Update CHANGELOG..."
|
||||||
|
sed -i.bak "2 a ## [${ADDON_NEXT_VERSION}] - $(date +%Y-%m-%d)" CHANGELOG.md
|
||||||
|
sed -i.bak "3 a - Update \`eufy-ha-mqtt-bridge\` to \`${MQTT_BRIDGE_VERSION}\` [Changelog](https://github.com/matijse/eufy-ha-mqtt-bridge/releases)\n" CHANGELOG.md
|
||||||
|
|
||||||
|
rm *.bak #cleanup, mac os related problem
|
||||||
Reference in New Issue
Block a user