Add version for Argon One V3 #230
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: CI | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- reopened | |
- synchronize | |
workflow_dispatch: | |
jobs: | |
information: | |
name: Gather add-on information | |
runs-on: ubuntu-latest | |
outputs: | |
architectures: ${{ steps.information.outputs.architectures }} | |
build: ${{ steps.information.outputs.build }} | |
description: ${{ steps.information.outputs.description }} | |
name: ${{ steps.information.outputs.name }} | |
slug: ${{ steps.information.outputs.slug }} | |
target: ${{ steps.information.outputs.target }} | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/[email protected] | |
- name: 🚀 Run add-on information action | |
id: information | |
uses: frenck/[email protected] | |
with: | |
path: "argonOne/" | |
lint-addon: | |
name: Lint Add-on | |
needs: | |
- information | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/[email protected] | |
- name: 🚀 Run Add-on Lint | |
uses: frenck/action-addon-linter@v2 | |
with: | |
path: "./${{ needs.information.outputs.target }}" | |
lint-hadolint: | |
name: Hadolint | |
needs: | |
- information | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/[email protected] | |
- name: 🚀 Run Hadolint | |
uses: brpaz/[email protected] | |
with: | |
dockerfile: "./${{ needs.information.outputs.target }}/Dockerfile" | |
lint-json: | |
name: JSON Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/[email protected] | |
- name: 🚀 Run JQ | |
run: | | |
shopt -s globstar | |
cat **/*.json | jq '.' | |
lint-markdown: | |
name: MarkdownLint | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/[email protected] | |
- name: 🚀 Run mdl | |
uses: actionshub/[email protected] | |
lint-shellcheck: | |
name: Shellcheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/[email protected] | |
- name: 🚀 Run Shellcheck | |
uses: ludeeus/[email protected] | |
env: | |
SHELLCHECK_OPTS: -s bash -e SC2206 -e SC1105 -e SC2046 -e SC2261 | |
lint-prettier: | |
name: Prettier | |
runs-on: ubuntu-latest | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/[email protected] | |
- name: 🚀 Run Prettier | |
uses: creyD/[email protected] | |
with: | |
prettier_options: --write **/*.{json,js,md,yaml} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
name: Build ${{ matrix.architecture }} | |
needs: | |
- information | |
- lint-addon | |
- lint-hadolint | |
- lint-json | |
- lint-markdown | |
- lint-prettier | |
- lint-shellcheck | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
architecture: ${{ fromJson(needs.information.outputs.architectures) }} | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/checkout@v3 | |
- 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: 🏗 Set up Codenotary Community Attestation Service (CAS) | |
uses: frenck/[email protected] | |
with: | |
version: v1.0.3 | |
- 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: ℹ️ Get Version | |
id: version | |
run: | | |
echo "version=$(date +"%Y-%m-%dT%H:%M:%SZ")" >> "$GITHUB_OUTPUT" | |
from=$(yq --no-colors eval ".build_from.${{ matrix.architecture }}" "${{ needs.information.outputs.build }}") | |
echo "version=$(grep version: argonOne/config.yaml|sed 's/version: //')" >> "$GITHUB_OUTPUT" | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: 🚀 Build | |
uses: docker/[email protected] | |
with: | |
push: true | |
no-cache: true | |
tags: adamoutler/${{ matrix.architecture }}-hassosargonone:${{ steps.version.outputs.version }} | |
context: ${{ needs.information.outputs.target }} | |
file: ${{ needs.information.outputs.target }}/Dockerfile | |
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=${{ needs.information.outputs.version }} |