Deploy #176
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Deploy | |
| # yamllint disable-line rule:truthy | |
| on: | |
| release: | |
| types: | |
| - published | |
| workflow_run: | |
| workflows: ["CI"] | |
| branches: [main] | |
| types: | |
| - completed | |
| concurrency: | |
| group: deploy | |
| jobs: | |
| workflows: | |
| uses: hassio-addons/workflows/.github/workflows/addon-deploy.yaml@main | |
| with: | |
| repository: "ha-addons" | |
| repository_beta: "ha-addons-beta" | |
| repository_edge: "ha-addons-edge" | |
| secrets: | |
| DISPATCH_TOKEN: ${{ secrets.DISPATCH_TOKEN }} | |
| permissions: | |
| contents: write | |
| packages: write | |
| information: | |
| needs: | |
| - workflows | |
| if: | | |
| github.event_name == 'release' | |
| || ( | |
| github.event_name == 'workflow_run' | |
| && github.event.workflow_run.conclusion == 'success' | |
| ) | |
| name: ℹ️ Gather add-on information | |
| runs-on: ubuntu-latest | |
| outputs: | |
| architectures: ${{ steps.information.outputs.architectures }} | |
| base_image_signer: ${{ steps.information.outputs.codenotary_base_image }} | |
| build: ${{ steps.information.outputs.build }} | |
| description: ${{ steps.information.outputs.description }} | |
| environment: ${{ steps.release.outputs.environment }} | |
| name: ${{ steps.information.outputs.name }} | |
| signer: ${{ steps.information.outputs.codenotary_signer }} | |
| slug: ${{ steps.override.outputs.slug }} | |
| target: ${{ steps.information.outputs.target }} | |
| version: ${{ steps.release.outputs.version }} | |
| steps: | |
| - name: ⤵️ Check out code from GitHub | |
| uses: actions/checkout@v4 | |
| - name: 🚀 Run add-on information action | |
| id: information | |
| uses: frenck/action-addon-information@v1.4.2 | |
| - name: 🚀 Process possible slug override | |
| id: override | |
| run: | | |
| slug="${{ steps.information.outputs.slug }}" | |
| if [[ ! -z "${{ inputs.slug }}" ]]; then | |
| slug="${{ inputs.slug }}" | |
| fi | |
| echo "slug=$slug" >> "$GITHUB_OUTPUT" | |
| - name: ℹ️ Gather version and environment | |
| id: release | |
| run: | | |
| sha="${{ github.sha }}" | |
| environment="edge" | |
| version="${sha:0:7}" | |
| if [[ "${{ github.event_name }}" = "release" ]]; then | |
| version="${{ github.event.release.tag_name }}" | |
| version="${version,,}" | |
| version="${version#v}" | |
| environment="stable" | |
| if [[ "${{ github.event.release.prerelease }}" = "true" ]]; then | |
| environment="beta" | |
| fi | |
| fi | |
| echo "environment=${environment}" >> "$GITHUB_OUTPUT" | |
| echo "version=${version}" >> "$GITHUB_OUTPUT" | |
| publish-stable: | |
| name: 📢 Publish to stable repository | |
| if: needs.information.outputs.environment == 'stable' | |
| needs: | |
| - information | |
| environment: | |
| name: ${{ needs.information.outputs.environment }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 🚀 Dispatch repository updater update signal | |
| uses: peter-evans/repository-dispatch@v3.0.0 | |
| with: | |
| token: ${{ secrets.DISPATCH_TOKEN }} | |
| repository: ${{ github.repository_owner }}/grott-home-assistant-add-on | |
| event-type: update | |
| client-payload: > | |
| { | |
| "addon": "${{ needs.information.outputs.slug }}", | |
| "name": "${{ needs.information.outputs.name }}", | |
| "repository": "${{ github.repository }}", | |
| "version": "${{ github.event.release.tag_name }}" | |
| } |