fix adduser options #11
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
# borrowed from https://github.com/hassio-addons/workflows/blob/main/.github/workflows/addon-ci.yaml | |
name: On Push | |
on: | |
pull_request: # any pull request | |
push: | |
branches: | |
- master | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
env: | |
NODE_VERSION: '20' | |
jobs: | |
build: | |
name: Build ${{ matrix.architecture }} | |
needs: | |
- information | |
- lint-addon | |
- lint-hadolint | |
- lint-shellcheck | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
architecture: ${{ fromJson(needs.information.outputs.architectures) }} | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/checkout@v4 | |
- name: 🏗 Set up build cache | |
id: cache | |
uses: actions/[email protected] | |
with: | |
path: /tmp/.docker-cache | |
key: docker-${{ matrix.architecture }}-${{ github.sha }} | |
restore-keys: | | |
docker-${{ matrix.architecture }} | |
- name: 🏗 Set up QEMU | |
uses: docker/[email protected] | |
- name: 🏗 Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: ℹ️ Compose build flags | |
id: flags | |
run: | | |
echo "date=$(date +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_OUTPUT" | |
from=$(yq --no-colors eval ".build_from.${{ matrix.architecture }}" "${{ needs.information.outputs.build }}") | |
echo "from=${from}" >> "$GITHUB_OUTPUT" | |
if [[ "${{ matrix.architecture}}" = "amd64" ]]; then | |
echo "platform=linux/amd64" >> "$GITHUB_OUTPUT" | |
elif [[ "${{ matrix.architecture }}" = "i386" ]]; then | |
echo "platform=linux/386" >> "$GITHUB_OUTPUT" | |
elif [[ "${{ matrix.architecture }}" = "armhf" ]]; then | |
echo "platform=linux/arm/v6" >> "$GITHUB_OUTPUT" | |
elif [[ "${{ matrix.architecture }}" = "armv7" ]]; then | |
echo "platform=linux/arm/v7" >> "$GITHUB_OUTPUT" | |
elif [[ "${{ matrix.architecture }}" = "aarch64" ]]; then | |
echo "platform=linux/arm64/v8" >> "$GITHUB_OUTPUT" | |
else | |
echo "::error ::Could not determine platform for architecture ${{ matrix.architecture }}" | |
exit 1 | |
fi | |
- name: ⤵️ Download base image | |
if: steps.flags.outputs.from != 'null' | |
run: docker pull "${{ steps.flags.outputs.from }}" | |
- name: 🚀 Build | |
uses: docker/[email protected] | |
with: | |
push: false | |
context: ${{ needs.information.outputs.target }} | |
file: ${{ needs.information.outputs.target }}/Dockerfile | |
cache-from: | | |
type=local,src=/tmp/.docker-cache | |
ghcr.io/${{ github.repository_owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge | |
cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new | |
platforms: ${{ steps.flags.outputs.platform }} | |
build-args: | | |
BUILD_ARCH=${{ matrix.architecture }} | |
BUILD_DATE=${{ steps.flags.outputs.date }} | |
BUILD_DESCRIPTION=${{ needs.information.outputs.description }} | |
BUILD_FROM=${{ steps.flags.outputs.from }} | |
BUILD_NAME=${{ needs.information.outputs.name }} | |
BUILD_REF=${{ github.sha }} | |
BUILD_REPOSITORY=${{ github.repository }} | |
BUILD_VERSION=edge | |
# This ugly bit is necessary, or our cache will grow forever... | |
# Well until we hit GitHub's limit of 5GB :) | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: 🚚 Swap build cache | |
run: | | |
rm -rf /tmp/.docker-cache | |
mv /tmp/.docker-cache-new /tmp/.docker-cache | |
information: | |
name: Gather add-on information | |
runs-on: ubuntu-latest | |
outputs: | |
architectures: ${{ steps.information.outputs.architectures }} | |
base_image_signer: ${{ steps.information.outputs.codenotary_base_image }} | |
build: ${{ steps.information.outputs.build }} | |
description: ${{ steps.information.outputs.description }} | |
name: ${{ steps.information.outputs.name }} | |
slug: ${{ steps.override.outputs.slug }} | |
target: ${{ steps.information.outputs.target }} | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/checkout@v4 | |
- name: 🚀 Run add-on information action | |
id: information | |
uses: frenck/[email protected] | |
- name: 🚀 Process possible slug override | |
id: override | |
run: | | |
slug="${{ steps.information.outputs.slug }}" | |
if [[ ! -z "${{ inputs.slug }}" ]]; then | |
slug="${{ inputs.slug }}" | |
fi | |
echo "slug=$slug" >> "$GITHUB_OUTPUT" | |
lint-addon: | |
name: Lint Add-on | |
needs: | |
- information | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/checkout@v4 | |
- name: 🚀 Run Add-on Lint | |
uses: frenck/[email protected] # cspell:words ludeeus | |
with: | |
community: false | |
path: "./${{ needs.information.outputs.target }}" | |
lint-hadolint: | |
name: Hadolint | |
needs: | |
- information | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/checkout@v4 | |
- name: 🚀 Run Hadolint | |
uses: brpaz/[email protected] # cspell:words brpaz | |
with: | |
dockerfile: "./${{ needs.information.outputs.target }}/Dockerfile" | |
lint-shellcheck: | |
name: Shellcheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/checkout@v4 | |
- name: 🚀 Run Shellcheck | |
uses: ludeeus/[email protected] # cspell:words ludeeus | |
env: | |
SHELLCHECK_OPTS: -s bash | |
spellcheck: | |
# There is an official action published by cSpell. | |
# v1.1.1 was tested but did not function as desired so we are using the CLI. | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- run: npm ci | |
- run: make spellcheck |