-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to centralized GitHub Action Workflows (#172)
- Loading branch information
Showing
9 changed files
with
45 additions
and
565 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,171 +12,7 @@ on: | |
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] | ||
|
||
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/[email protected] | ||
with: | ||
community: true | ||
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 | ||
|
||
lint-yamllint: | ||
name: YAMLLint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/[email protected] | ||
- name: 🚀 Run YAMLLint | ||
uses: frenck/[email protected] | ||
|
||
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 | ||
- lint-yamllint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
architecture: ${{ fromJson(needs.information.outputs.architectures) }} | ||
steps: | ||
- name: ⤵️ Check out code from GitHub | ||
uses: actions/[email protected] | ||
- name: 🏗 Set up build cache | ||
id: cache | ||
uses: actions/[email protected] | ||
with: | ||
path: /tmp/.docker-cache | ||
key: docker-${{ github.ref }}-${{ matrix.architecture }}-${{ github.sha }} | ||
restore-keys: | | ||
docker-${{ github.ref }}-${{ 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 "::set-output name=date::$(date +"%Y-%m-%dT%H:%M:%SZ")" | ||
from=$(jq --raw-output ".build_from.${{ matrix.architecture }}" "${{ needs.information.outputs.build }}") | ||
echo "::set-output name=from::${from}" | ||
if [[ "${{ matrix.architecture}}" = "amd64" ]]; then | ||
echo "::set-output name=platform::linux/amd64" | ||
elif [[ "${{ matrix.architecture }}" = "i386" ]]; then | ||
echo "::set-output name=platform::linux/386" | ||
elif [[ "${{ matrix.architecture }}" = "armhf" ]]; then | ||
echo "::set-output name=platform::linux/arm/v6" | ||
elif [[ "${{ matrix.architecture }}" = "armv7" ]]; then | ||
echo "::set-output name=platform::linux/arm/v7" | ||
elif [[ "${{ matrix.architecture }}" = "aarch64" ]]; then | ||
echo "::set-output name=platform::linux/arm64/v8" | ||
else | ||
echo "::error ::Could not determine platform for architecture ${{ matrix.architecture }}" | ||
exit 1 | ||
fi | ||
- 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/hassio-addons/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge | ||
cache-to: type=local,mode=max,dest=/tmp/.docker-cache | ||
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 | ||
workflows: | ||
uses: hassio-addons/workflows/.github/workflows/addon-ci.yaml@main | ||
secrets: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Oops, something went wrong.