Skip to content

chore(release): publish 0.1.3 #57

chore(release): publish 0.1.3

chore(release): publish 0.1.3 #57

Workflow file for this run

name: Publish Home Assistant Add-on
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
inputs:
publish_channel:
description: Image tags to publish
required: true
default: dev
type: choice
options:
- dev
- versioned
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
env:
ADDON_VERSION: ${{ steps.version.outputs.value }}
PUBLISH_CHANNEL: ${{ github.event.inputs.publish_channel || 'dev' }}
run: |
IMAGE="ghcr.io/${{ github.repository_owner }}/${{ matrix.arch }}-navet-addon"
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
CHANNEL="versioned"
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
CHANNEL="${PUBLISH_CHANNEL:-dev}"
else
CHANNEL="dev"
fi
if [ "$CHANNEL" = "dev" ]; then
{
echo "value<<EOF"
echo "$IMAGE:dev"
echo "$IMAGE:sha-${GITHUB_SHA::7}"
echo "EOF"
} >> "$GITHUB_OUTPUT"
elif [ "$CHANNEL" = "versioned" ]; then
{
echo "value<<EOF"
echo "$IMAGE:$ADDON_VERSION"
case "$GITHUB_REF_NAME" in
*-alpha.* | *-beta.* | *-rc.*)
echo "$IMAGE:beta"
echo "$IMAGE:latest"
;;
esac
echo "$IMAGE:sha-${GITHUB_SHA::7}"
echo "EOF"
} >> "$GITHUB_OUTPUT"
else
echo "Unsupported publish channel: $CHANNEL" >&2
exit 1
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.ref_type == 'tag' && steps.version.outputs.value || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_channel == 'versioned' && steps.version.outputs.value || 'dev') }}
BUILD_ARCH=${{ matrix.arch }}
tags: ${{ steps.tags.outputs.value }}