Update README.md #157
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: Publish Home Assistant Add-ons | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'twingate/**' | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
addon: [twingate] # all add-ons | |
architecture: [armv7, aarch64, amd64, i386] # all architectures | |
env: | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Get changed folders | |
id: get_changed_folders | |
run: | | |
echo "Changed folders: ${{ github.event.head_commit.modified }}" | |
echo "::set-output name=changed_folders::${{ github.event.head_commit.modified }}" | |
echo "${{ github.event.head_commit.modified }}" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Authenticate GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.HA_GITHUB_TOKEN }} | |
- name: Set lowercase repository and owner names | |
run: | | |
echo "REPO_NAME_LC=$(echo ${GITHUB_REPOSITORY} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Set BUILD_FROM, PLATFORM, and VERSION variables | |
run: | | |
BUILD_FROM=$(yq e ".build_from.${{ matrix.architecture }}" ./${{ matrix.addon }}/build.yaml) | |
PLATFORM=$(yq e ".platform.${{ matrix.architecture }}" ./${{ matrix.addon }}/build.yaml) | |
VERSION=$(yq e ".version" ./${{ matrix.addon }}/config.yaml) | |
echo "BUILD_FROM=${BUILD_FROM}" >> $GITHUB_ENV | |
echo "PLATFORM=${PLATFORM}" >> $GITHUB_ENV | |
echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Build and push Docker images | |
run: | | |
docker buildx build --platform linux/${{ env.PLATFORM }} \ | |
--build-arg BUILD_FROM=${{ env.BUILD_FROM }} \ | |
--push \ | |
-t ghcr.io/${{ env.REPO_NAME_LC }}-${{ matrix.addon }}-${{ matrix.architecture }}:${{ env.VERSION }} \ | |
./${{ matrix.addon }} | |