From c127a3e259f5f912603fa6aab3cbca7b8da238e0 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Tue, 28 Jul 2020 23:20:29 +0200 Subject: [PATCH] Add actions workflow to update community addons (#12) --- .github/workflows/bump-version.yml | 69 ++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/bump-version.yml diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml new file mode 100644 index 0000000..52a41e0 --- /dev/null +++ b/.github/workflows/bump-version.yml @@ -0,0 +1,69 @@ +name: Publish Release + +on: + workflow_dispatch: + inputs: + version: + description: The version to release + required: true + +jobs: + create-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: '3.x' + - run: pip install -r script/requirements.txt + - run: script/bump-version.py ${{ github.event.inputs.version }} + - run: | + git config user.name github-actions + git config user.email github-actions@github.com + git add . + git commit -m "Bump version to v${{ github.event.inputs.version }}" + git push + - if: ${{ contains(github.event.inputs.version, 'b') }} + name: Create Beta Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ github.event.inputs.version }} + release_name: ${{ github.event.inputs.version }} + body: 'See https://beta.esphome.io/changelog/index.html' + prerelease: true + - if: ${{ !contains(github.event.inputs.version, 'b') }} + name: Create Stable Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: v${{ github.event.inputs.version }} + release_name: ${{ github.event.inputs.version }} + body: 'See https://esphome.io/changelog/index.html' + prerelease: false + + + deploy-community-addons: + runs-on: ubuntu-latest + needs: [create-release] + steps: + - if: ${{ contains(github.event.inputs.version, 'b') }} + name: Publish beta release to community-addons repository + run: | + docker run -it --rm hassioaddons/repository-updater:latest \ + --repository hassio-addons/repository-beta \ + --addon esphome \ + --token "${TOKEN}" + env: + TOKEN: ${{ secrets.COMMUNITY_ADDONS_TOKEN }} + - if: ${{ !contains(github.event.inputs.version, 'b') }} + name: Publish stable release to community-addons repository + run: | + docker run -it --rm hassioaddons/repository-updater:latest \ + --repository hassio-addons/repository \ + --addon esphome \ + --token "${TOKEN}" + env: + TOKEN: ${{ secrets.COMMUNITY_ADDONS_TOKEN }}