|
12 | 12 | workflow_dispatch: |
13 | 13 |
|
14 | 14 | jobs: |
15 | | - information: |
16 | | - name: Gather add-on information |
17 | | - runs-on: ubuntu-latest |
18 | | - outputs: |
19 | | - architectures: ${{ steps.information.outputs.architectures }} |
20 | | - build: ${{ steps.information.outputs.build }} |
21 | | - description: ${{ steps.information.outputs.description }} |
22 | | - name: ${{ steps.information.outputs.name }} |
23 | | - slug: ${{ steps.information.outputs.slug }} |
24 | | - target: ${{ steps.information.outputs.target }} |
25 | | - steps: |
26 | | - - name: ⤵️ Check out code from GitHub |
27 | | - uses: actions/checkout@v2.3.5 |
28 | | - - name: 🚀 Run add-on information action |
29 | | - id: information |
30 | | - uses: frenck/action-addon-information@v1.2.2 |
31 | | - |
32 | | - lint-addon: |
33 | | - name: Lint Add-on |
34 | | - needs: |
35 | | - - information |
36 | | - runs-on: ubuntu-latest |
37 | | - steps: |
38 | | - - name: ⤵️ Check out code from GitHub |
39 | | - uses: actions/checkout@v2.3.5 |
40 | | - - name: 🚀 Run Add-on Lint |
41 | | - uses: frenck/action-addon-linter@v2.4.1 |
42 | | - with: |
43 | | - community: true |
44 | | - path: "./${{ needs.information.outputs.target }}" |
45 | | - |
46 | | - lint-hadolint: |
47 | | - name: Hadolint |
48 | | - needs: |
49 | | - - information |
50 | | - runs-on: ubuntu-latest |
51 | | - steps: |
52 | | - - name: ⤵️ Check out code from GitHub |
53 | | - uses: actions/checkout@v2.3.5 |
54 | | - - name: 🚀 Run Hadolint |
55 | | - uses: brpaz/hadolint-action@v1.5.0 |
56 | | - with: |
57 | | - dockerfile: "./${{ needs.information.outputs.target }}/Dockerfile" |
58 | | - |
59 | | - lint-json: |
60 | | - name: JSON Lint |
61 | | - runs-on: ubuntu-latest |
62 | | - steps: |
63 | | - - name: ⤵️ Check out code from GitHub |
64 | | - uses: actions/checkout@v2.3.5 |
65 | | - - name: 🚀 Run JQ |
66 | | - run: | |
67 | | - shopt -s globstar |
68 | | - cat **/*.json | jq '.' |
69 | | -
|
70 | | - lint-markdown: |
71 | | - name: MarkdownLint |
72 | | - runs-on: ubuntu-latest |
73 | | - steps: |
74 | | - - name: ⤵️ Check out code from GitHub |
75 | | - uses: actions/checkout@v2.3.5 |
76 | | - - name: 🚀 Run mdl |
77 | | - uses: actionshub/markdownlint@2.0.2 |
78 | | - |
79 | | - lint-shellcheck: |
80 | | - name: Shellcheck |
81 | | - runs-on: ubuntu-latest |
82 | | - steps: |
83 | | - - name: ⤵️ Check out code from GitHub |
84 | | - uses: actions/checkout@v2.3.5 |
85 | | - - name: 🚀 Run Shellcheck |
86 | | - uses: ludeeus/action-shellcheck@1.1.0 |
87 | | - env: |
88 | | - SHELLCHECK_OPTS: -s bash |
89 | | - |
90 | | - lint-yamllint: |
91 | | - name: YAMLLint |
92 | | - runs-on: ubuntu-latest |
93 | | - steps: |
94 | | - - name: ⤵️ Check out code from GitHub |
95 | | - uses: actions/checkout@v2.3.5 |
96 | | - - name: 🚀 Run YAMLLint |
97 | | - uses: frenck/action-yamllint@v1.1 |
98 | | - |
99 | | - lint-prettier: |
100 | | - name: Prettier |
101 | | - runs-on: ubuntu-latest |
102 | | - steps: |
103 | | - - name: ⤵️ Check out code from GitHub |
104 | | - uses: actions/checkout@v2.3.5 |
105 | | - - name: 🚀 Run Prettier |
106 | | - uses: creyD/prettier_action@v4.0 |
107 | | - with: |
108 | | - prettier_options: --write **/*.{json,js,md,yaml} |
109 | | - env: |
110 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
111 | | - |
112 | | - build: |
113 | | - name: Build ${{ matrix.architecture }} |
114 | | - needs: |
115 | | - - information |
116 | | - - lint-addon |
117 | | - - lint-hadolint |
118 | | - - lint-json |
119 | | - - lint-markdown |
120 | | - - lint-prettier |
121 | | - - lint-shellcheck |
122 | | - - lint-yamllint |
123 | | - runs-on: ubuntu-latest |
124 | | - strategy: |
125 | | - matrix: |
126 | | - architecture: ${{ fromJson(needs.information.outputs.architectures) }} |
127 | | - steps: |
128 | | - - name: ⤵️ Check out code from GitHub |
129 | | - uses: actions/checkout@v2.3.5 |
130 | | - - name: 🏗 Set up build cache |
131 | | - id: cache |
132 | | - uses: actions/cache@v2.1.6 |
133 | | - with: |
134 | | - path: /tmp/.docker-cache |
135 | | - key: docker-${{ matrix.architecture }}-${{ github.sha }} |
136 | | - restore-keys: | |
137 | | - docker-${{ matrix.architecture }} |
138 | | - - name: 🏗 Set up QEMU |
139 | | - uses: docker/setup-qemu-action@v1.2.0 |
140 | | - - name: 🏗 Set up Docker Buildx |
141 | | - uses: docker/setup-buildx-action@v1.6.0 |
142 | | - - name: 🏗 Set up CodeNotary |
143 | | - run: bash <(curl https://getvcn.codenotary.com -L) |
144 | | - - name: ℹ️ Compose build flags |
145 | | - id: flags |
146 | | - run: | |
147 | | - echo "::set-output name=date::$(date +"%Y-%m-%dT%H:%M:%SZ")" |
148 | | - from=$(jq --raw-output ".build_from.${{ matrix.architecture }}" "${{ needs.information.outputs.build }}") |
149 | | - echo "::set-output name=from::${from}" |
150 | | -
|
151 | | - if [[ "${{ matrix.architecture}}" = "amd64" ]]; then |
152 | | - echo "::set-output name=platform::linux/amd64" |
153 | | - elif [[ "${{ matrix.architecture }}" = "i386" ]]; then |
154 | | - echo "::set-output name=platform::linux/386" |
155 | | - elif [[ "${{ matrix.architecture }}" = "armhf" ]]; then |
156 | | - echo "::set-output name=platform::linux/arm/v6" |
157 | | - elif [[ "${{ matrix.architecture }}" = "armv7" ]]; then |
158 | | - echo "::set-output name=platform::linux/arm/v7" |
159 | | - elif [[ "${{ matrix.architecture }}" = "aarch64" ]]; then |
160 | | - echo "::set-output name=platform::linux/arm64/v8" |
161 | | - else |
162 | | - echo "::error ::Could not determine platform for architecture ${{ matrix.architecture }}" |
163 | | - exit 1 |
164 | | - fi |
165 | | - - name: ⤵️ Download base image |
166 | | - run: docker pull "${{ steps.flags.outputs.from }}" |
167 | | - - name: ✅ Verify authenticity of base image |
168 | | - run: | |
169 | | - vcn authenticate \ |
170 | | - "docker://${{ steps.flags.outputs.from }}" |
171 | | - vcn authenticate \ |
172 | | - --output json \ |
173 | | - --signerID 0x03e406879fd89e52f38f4aab0061266d1183980a \ |
174 | | - "docker://${{ steps.flags.outputs.from }}" \ |
175 | | - | jq \ |
176 | | - --exit-status \ |
177 | | - '.verification.status == 0' |
178 | | - - name: 🚀 Build |
179 | | - uses: docker/build-push-action@v2.7.0 |
180 | | - with: |
181 | | - push: false |
182 | | - context: ${{ needs.information.outputs.target }} |
183 | | - file: ${{ needs.information.outputs.target }}/Dockerfile |
184 | | - cache-from: | |
185 | | - type=local,src=/tmp/.docker-cache |
186 | | - ghcr.io/hassio-addons/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:edge |
187 | | - cache-to: type=local,mode=max,dest=/tmp/.docker-cache-new |
188 | | - platforms: ${{ steps.flags.outputs.platform }} |
189 | | - build-args: | |
190 | | - BUILD_ARCH=${{ matrix.architecture }} |
191 | | - BUILD_DATE=${{ steps.flags.outputs.date }} |
192 | | - BUILD_DESCRIPTION=${{ needs.information.outputs.description }} |
193 | | - BUILD_FROM=${{ steps.flags.outputs.from }} |
194 | | - BUILD_NAME=${{ needs.information.outputs.name }} |
195 | | - BUILD_REF=${{ github.sha }} |
196 | | - BUILD_REPOSITORY=${{ github.repository }} |
197 | | - BUILD_VERSION=edge |
198 | | - # This ugly bit is necessary, or our cache will grow forever... |
199 | | - # Well until we hit GitHub's limit of 5GB :) |
200 | | - # https://github.com/docker/build-push-action/issues/252 |
201 | | - # https://github.com/moby/buildkit/issues/1896 |
202 | | - - name: 🚚 Swap build cache |
203 | | - run: | |
204 | | - rm -rf /tmp/.docker-cache |
205 | | - mv /tmp/.docker-cache-new /tmp/.docker-cache |
| 15 | + workflows: |
| 16 | + uses: hassio-addons/workflows/.github/workflows/addon-ci.yaml@main |
| 17 | + secrets: |
| 18 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments