Add Home Assistant add-on overrides and initialization script #10
This file contains 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: Twingate | |
# Controls when the workflow will run | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
- 'twingate-0.0.1' | |
tags: | |
- 'v*.*.*' | |
paths: | |
- 'twingate/Dockerfile' | |
- '.github/workflows/twingate.yml' | |
- 'twingate/run.sh' | |
- 'twingate/config.json' | |
jobs: | |
twingate: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
# AMD64 | |
- DOCKER_TAG_SUFFIX: amd64 | |
S6_ARCH: amd64 | |
BASE_IMAGE: ghcr.io/home-assistant/amd64-base-ubuntu:20.04 | |
PLATFORMS: linux/amd64 | |
QEMU_ARCH: x86_64 | |
# # ARM32V7 | |
# - DOCKER_TAG_SUFFIX: armv7 | |
# S6_ARCH: armv7 | |
# BASE_IMAGE: ghcr.io/home-assistant/armv7-base-ubuntu:20.04 | |
# PLATFORMS: linux/arm/v7 | |
# QEMU_ARCH: arm | |
# ARM64V8 | |
- DOCKER_TAG_SUFFIX: aarch64 | |
S6_ARCH: aarch64 | |
BASE_IMAGE: ghcr.io/home-assistant/aarch64-base-ubuntu:20.04 | |
PLATFORMS: linux/arm64 | |
QEMU_ARCH: aarch64 | |
steps: | |
# Get the repository's code | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# https://github.com/docker/setup-qemu-action | |
- name: Get the version from config.json | |
id: data | |
run: | | |
version=$(jq --raw-output '.version' ./twingate/config.json) | |
echo "::set-output name=HA_RELEASE::$version" | |
- name: Twingate release | |
run: echo ${{ steps.data.outputs.HA_RELEASE }} | |
- name: Set up QEMU | |
uses: docker/[email protected] | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/[email protected] | |
- name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker meta | |
id: meta # you'll use this in the next step | |
uses: docker/[email protected] | |
with: | |
# list of Docker images to use as base name for tags | |
images: | | |
sanderdw/ha-twingate-${{ matrix.DOCKER_TAG_SUFFIX }} | |
# Docker tags based on the following events/attributes | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=raw,value=${{ steps.data.outputs.HA_RELEASE }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./twingate | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
BUILD_FROM=${{matrix.BASE_IMAGE}} | |
HA_RELEASE=${{ steps.data.outputs.HA_RELEASE }} | |
BUILD_ARCH=${{matrix.S6_ARCH}} |