Home Assistant Add-on Publish #2
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: Home Assistant Add-on Publish | |
| on: | |
| # Trigger after SemVer Release completes | |
| workflow_run: | |
| workflows: ["SemVer Release"] | |
| types: [completed] | |
| branches: [ main, master ] | |
| # Also support manual dispatch | |
| workflow_dispatch: | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_PREFIX: ghcr.io/${{ github.repository }}-addon | |
| jobs: | |
| build-addon: | |
| name: Build Add-on Image (${{ matrix.arch }}) | |
| runs-on: ubuntu-latest | |
| # Only run if SemVer Release workflow succeeded | |
| if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| matrix: | |
| arch: | |
| - amd64 | |
| - aarch64 | |
| include: | |
| - arch: amd64 | |
| platform: linux/amd64 | |
| - arch: aarch64 | |
| platform: linux/arm64 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract version from config.yaml | |
| id: version | |
| run: | | |
| VERSION=$(grep '^version:' homeassistant-addon/config.yaml | sed 's/version: "\(.*\)"/\1/') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Add-on version: $VERSION" | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./homeassistant-addon/Dockerfile | |
| push: true | |
| platforms: ${{ matrix.platform }} | |
| tags: | | |
| ${{ env.IMAGE_PREFIX }}-${{ matrix.arch }}:latest | |
| ${{ env.IMAGE_PREFIX }}-${{ matrix.arch }}:${{ steps.version.outputs.version }} | |
| labels: | | |
| io.hass.name=Home Assistant MCP Server | |
| io.hass.description=AI assistant integration via Model Context Protocol | |
| io.hass.version=${{ steps.version.outputs.version }} | |
| io.hass.type=addon | |
| io.hass.arch=${{ matrix.arch }} | |
| cache-from: type=gha,scope=${{ matrix.arch }} | |
| cache-to: type=gha,mode=max,scope=${{ matrix.arch }} | |
| build-args: | | |
| BUILD_VERSION=${{ steps.version.outputs.version }} | |
| BUILD_ARCH=${{ matrix.arch }} |