Skip to content

Merge pull request #23 from mzspicoli/feature/pt-locale #32

Merge pull request #23 from mzspicoli/feature/pt-locale

Merge pull request #23 from mzspicoli/feature/pt-locale #32

Workflow file for this run

name: Publish Home Assistant Add-on
on:
push:
branches:
- main
tags:
- 'v*-alpha.*'
- 'v*-beta.*'
- 'v*-rc.*'
workflow_dispatch:
permissions:
contents: read
packages: write
concurrency:
group: publish-addon-${{ github.ref }}
cancel-in-progress: true
jobs:
publish-addon:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- arch: amd64
platform: linux/amd64
build_from: ghcr.io/home-assistant/amd64-base:3.20
- arch: aarch64
platform: linux/arm64
build_from: ghcr.io/home-assistant/aarch64-base:3.20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Read add-on version
id: version
run: |
VERSION=$(sed -n 's/^version: "\(.*\)"/\1/p' addons/navet/config.yaml)
if [ -z "$VERSION" ]; then
echo "Unable to read add-on version from addons/navet/config.yaml" >&2
exit 1
fi
echo "value=$VERSION" >> "$GITHUB_OUTPUT"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve add-on image tags
id: tags
run: |
IMAGE="ghcr.io/${{ github.repository_owner }}/${{ matrix.arch }}-navet-addon"
if [ "${{ github.event_name }}" = "workflow_dispatch" ] || [ "${GITHUB_REF_TYPE}" = "branch" ]; then
{
echo "value<<EOF"
echo "$IMAGE:dev"
echo "$IMAGE:sha-${GITHUB_SHA::7}"
echo "EOF"
} >> "$GITHUB_OUTPUT"
else
{
echo "value<<EOF"
echo "$IMAGE:${{ steps.version.outputs.value }}"
echo "$IMAGE:beta"
echo "$IMAGE:latest"
echo "$IMAGE:sha-${GITHUB_SHA::7}"
echo "EOF"
} >> "$GITHUB_OUTPUT"
fi
- name: Build add-on image
uses: docker/build-push-action@v6
with:
context: .
file: ./addons/navet/Dockerfile
platforms: ${{ matrix.platform }}
push: true
build-args: |
BUILD_FROM=${{ matrix.build_from }}
BUILD_VERSION=${{ github.event_name == 'workflow_dispatch' && 'dev' || (github.ref_type == 'branch' && 'dev' || steps.version.outputs.value) }}
BUILD_ARCH=${{ matrix.arch }}
tags: ${{ steps.tags.outputs.value }}