Skip to content

Commit 55ab5c8

Browse files
Adjust workflows per feedback
Co-authored-by: MinecraftFuns <25814618+MinecraftFuns@users.noreply.github.com>
1 parent 18bd98d commit 55ab5c8

8 files changed

Lines changed: 428 additions & 493 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 7 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -20,170 +20,10 @@ permissions:
2020
pull-requests: read
2121

2222
jobs:
23-
information:
24-
name: Gather app (add-on) information
25-
runs-on: ubuntu-latest
26-
outputs:
27-
architectures: ${{ steps.information.outputs.architectures }}
28-
build: ${{ steps.information.outputs.build }}
29-
description: ${{ steps.information.outputs.description }}
30-
name: ${{ steps.information.outputs.name }}
31-
slug: ${{ steps.override.outputs.slug }}
32-
target: ${{ steps.information.outputs.target }}
33-
steps:
34-
- name: ⤵️ Check out code from GitHub
35-
uses: actions/checkout@v6.0.1
36-
- name: 🚀 Run app (add-on) information action
37-
id: information
38-
uses: homeassistant-apps/action-app-information@v2
39-
- name: 🚀 Process possible slug override
40-
id: override
41-
run: |
42-
slug="${{ steps.information.outputs.slug }}"
43-
if [[ ! -z "${{ inputs.slug }}" ]]; then
44-
slug="${{ inputs.slug }}"
45-
fi
46-
echo "slug=$slug" >> $GITHUB_OUTPUT
47-
48-
lint-addon:
49-
name: Lint App (Add-on)
50-
needs:
51-
- information
52-
runs-on: ubuntu-latest
53-
steps:
54-
- name: ⤵️ Check out code from GitHub
55-
uses: actions/checkout@v6.0.1
56-
- name: 🚀 Run Add-on Lint
57-
uses: homeassistant-apps/action-app-linter@v3.1
58-
with:
59-
community: true
60-
path: "./${{ needs.information.outputs.target }}"
61-
62-
lint-hadolint:
63-
name: Hadolint
64-
needs:
65-
- information
66-
runs-on: ubuntu-latest
67-
steps:
68-
- name: ⤵️ Check out code from GitHub
69-
uses: actions/checkout@v6.0.1
70-
- name: 🚀 Run Hadolint
71-
uses: brpaz/hadolint-action@v1.5.0
72-
with:
73-
dockerfile: "./${{ needs.information.outputs.target }}/Dockerfile"
74-
75-
lint-json:
76-
name: JSON Lint
77-
runs-on: ubuntu-latest
78-
steps:
79-
- name: ⤵️ Check out code from GitHub
80-
uses: actions/checkout@v6.0.1
81-
- name: 🚀 Run JQ
82-
run: |
83-
shopt -s globstar
84-
cat **/*.json | jq '.'
85-
86-
lint-markdown:
87-
name: MarkdownLint
88-
runs-on: ubuntu-latest
89-
steps:
90-
- name: ⤵️ Check out code from GitHub
91-
uses: actions/checkout@v6.0.1
92-
- name: 🚀 Run mdl
93-
uses: actionshub/markdownlint@v3.1.4
94-
95-
lint-shellcheck:
96-
name: Shellcheck
97-
runs-on: ubuntu-latest
98-
steps:
99-
- name: ⤵️ Check out code from GitHub
100-
uses: actions/checkout@v6.0.1
101-
- name: 🚀 Run Shellcheck
102-
uses: ludeeus/action-shellcheck@2.0.0
103-
env:
104-
SHELLCHECK_OPTS: -s bash
105-
106-
lint-yamllint:
107-
name: YAMLLint
108-
runs-on: ubuntu-latest
109-
steps:
110-
- name: ⤵️ Check out code from GitHub
111-
uses: actions/checkout@v6.0.1
112-
- name: 🚀 Run YAMLLint
113-
uses: frenck/action-yamllint@v1.5
114-
115-
lint-prettier:
116-
name: Prettier
117-
runs-on: ubuntu-latest
118-
steps:
119-
- name: ⤵️ Check out code from GitHub
120-
uses: actions/checkout@v6.0.1
121-
- name: 🚀 Run Prettier
122-
uses: creyD/prettier_action@v4.6
123-
with:
124-
prettier_options: --write **/*.{json,js,md,yaml}
125-
126-
build:
127-
name: Build ${{ matrix.architecture }}
128-
needs:
129-
- information
130-
- lint-addon
131-
- lint-hadolint
132-
- lint-json
133-
- lint-markdown
134-
- lint-prettier
135-
- lint-shellcheck
136-
- lint-yamllint
137-
runs-on: ubuntu-latest
138-
strategy:
139-
matrix:
140-
architecture: ${{ fromJson(needs.information.outputs.architectures) }}
141-
steps:
142-
- name: ⤵️ Check out code from GitHub
143-
uses: actions/checkout@v6.0.1
144-
- name: 🏗 Set up QEMU
145-
uses: docker/setup-qemu-action@v3.7.0
146-
- name: 🏗 Set up Docker Buildx
147-
uses: docker/setup-buildx-action@v3.12.0
148-
- name: ℹ️ Compose build flags
149-
id: flags
150-
run: |
151-
echo "date=$(date +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT
152-
if [[ "${{ matrix.architecture}}" = "amd64" ]]; then
153-
echo "platform=linux/amd64" >> $GITHUB_OUTPUT
154-
elif [[ "${{ matrix.architecture }}" = "aarch64" ]]; then
155-
echo "platform=linux/arm64/v8" >> $GITHUB_OUTPUT
156-
else
157-
echo "::error ::Could not determine platform for architecture ${{ matrix.architecture }}"
158-
exit 1
159-
fi
160-
- name: 🚀 Build
161-
uses: docker/build-push-action@v6.18.0
162-
with:
163-
push: false
164-
context: ${{ needs.information.outputs.target }}
165-
file: ${{ needs.information.outputs.target }}/Dockerfile
166-
cache-from: type=gha,scope=${{ needs.information.outputs.slug }}-${{ matrix.architecture }}
167-
cache-to: type=gha,mode=max,scope=${{ needs.information.outputs.slug }}-${{ matrix.architecture }}
168-
platforms: ${{ steps.flags.outputs.platform }}
169-
build-args: |
170-
BUILD_ARCH=${{ matrix.architecture }}
171-
BUILD_DATE=${{ steps.flags.outputs.date }}
172-
BUILD_DESCRIPTION=${{ needs.information.outputs.description }}
173-
BUILD_FROM=${{ steps.flags.outputs.from }}
174-
BUILD_NAME=${{ needs.information.outputs.name }}
175-
BUILD_REF=${{ github.sha }}
176-
BUILD_REPOSITORY=${{ github.repository }}
177-
BUILD_VERSION=edge
178-
179-
update_release_draft:
180-
name: Draft release
181-
needs:
182-
- build
183-
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
184-
runs-on: ubuntu-latest
185-
steps:
186-
- name: 🚀 Run Release Drafter
187-
uses: homeassistant-apps/action-release-drafter@v6.1.1
188-
env:
189-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
ci:
24+
uses: ./.github/workflows/upstream/ci.yaml
25+
secrets: inherit
26+
with:
27+
default_branch: ${{ github.event.repository.default_branch }}
28+
event_name: ${{ github.event_name }}
29+
ref_name: ${{ github.ref_name }}

.github/workflows/deploy.yaml

Lines changed: 8 additions & 188 deletions
Original file line numberDiff line numberDiff line change
@@ -11,202 +11,22 @@ on:
1111
branches: [main]
1212
types:
1313
- completed
14-
concurrency:
15-
group: deploy
1614

1715
permissions:
1816
contents: read
1917
packages: write
2018

2119
jobs:
22-
information:
23-
if: |
20+
deploy:
21+
if: >
2422
github.event_name == 'release'
2523
|| (
2624
github.event_name == 'workflow_run'
2725
&& github.event.workflow_run.conclusion == 'success'
2826
)
29-
name: ℹ️ Gather app (add-on) information
30-
runs-on: ubuntu-latest
31-
outputs:
32-
architectures: ${{ steps.information.outputs.architectures }}
33-
build: ${{ steps.information.outputs.build }}
34-
description: ${{ steps.information.outputs.description }}
35-
environment: ${{ steps.release.outputs.environment }}
36-
name: ${{ steps.information.outputs.name }}
37-
slug: ${{ steps.override.outputs.slug }}
38-
target: ${{ steps.information.outputs.target }}
39-
version: ${{ steps.release.outputs.version }}
40-
steps:
41-
- name: ⤵️ Check out code from GitHub
42-
uses: actions/checkout@v6.0.1
43-
- name: 🚀 Run app (add-on) information action
44-
id: information
45-
uses: homeassistant-apps/action-app-information@v2
46-
- name: 🚀 Process possible slug override
47-
id: override
48-
run: |
49-
slug="${{ steps.information.outputs.slug }}"
50-
if [[ ! -z "${{ inputs.slug }}" ]]; then
51-
slug="${{ inputs.slug }}"
52-
fi
53-
echo "slug=$slug" >> $GITHUB_OUTPUT
54-
- name: ℹ️ Gather version and environment
55-
id: release
56-
run: |
57-
sha="${{ github.sha }}"
58-
environment="edge"
59-
version="${sha:0:7}"
60-
if [[ "${{ github.event_name }}" = "release" ]]; then
61-
version="${{ github.event.release.tag_name }}"
62-
version="${version,,}"
63-
version="${version#v}"
64-
environment="stable"
65-
if [[ "${{ github.event.release.prerelease }}" = "true" ]]; then
66-
environment="beta"
67-
fi
68-
fi
69-
70-
echo "environment=$environment" >> $GITHUB_OUTPUT
71-
echo "version=$version" >> $GITHUB_OUTPUT
72-
73-
deploy:
74-
name: 👷 Build & Deploy ${{ matrix.architecture }}
75-
needs: information
76-
runs-on: ubuntu-latest
77-
strategy:
78-
matrix:
79-
architecture: ${{ fromJson(needs.information.outputs.architectures) }}
80-
steps:
81-
- name: ⤵️ Check out code from GitHub
82-
uses: actions/checkout@v6.0.1
83-
- name: 🏗 Set up QEMU
84-
uses: docker/setup-qemu-action@v3.7.0
85-
- name: 🏗 Set up Docker Buildx
86-
uses: docker/setup-buildx-action@v3.12.0
87-
- name: ℹ️ Compose build flags
88-
id: flags
89-
run: |
90-
echo "date=$(date +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT
91-
if [[ "${{ matrix.architecture}}" = "amd64" ]]; then
92-
echo "platform=linux/amd64" >> $GITHUB_OUTPUT
93-
elif [[ "${{ matrix.architecture }}" = "aarch64" ]]; then
94-
echo "platform=linux/arm64/v8" >> $GITHUB_OUTPUT
95-
else
96-
echo "::error ::Could not determine platform for architecture ${{ matrix.architecture }}"
97-
exit 1
98-
fi
99-
- name: 🔤 Normalize registry owner
100-
id: registry
101-
run: |
102-
owner="${GITHUB_REPOSITORY_OWNER,,}"
103-
echo "owner=$owner" >> "$GITHUB_OUTPUT"
104-
- name: 🏗 Login to GitHub Container Registry
105-
uses: docker/login-action@v3.6.0
106-
with:
107-
registry: ghcr.io
108-
username: ${{ steps.registry.outputs.owner }}
109-
password: ${{ secrets.GITHUB_TOKEN }}
110-
- name: 🚀 Build
111-
uses: docker/build-push-action@v6.18.0
112-
with:
113-
load: true
114-
# yamllint disable rule:line-length
115-
tags: |
116-
ghcr.io/${{ steps.registry.outputs.owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.environment }}
117-
ghcr.io/${{ steps.registry.outputs.owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.version }}
118-
# yamllint enable rule:line-length
119-
context: ${{ needs.information.outputs.target }}
120-
file: ${{ needs.information.outputs.target }}/Dockerfile
121-
cache-from: type=gha,scope=${{ needs.information.outputs.slug }}-${{ matrix.architecture }}
122-
cache-to: type=gha,mode=max,scope=${{ needs.information.outputs.slug }}-${{ matrix.architecture }}
123-
platforms: ${{ steps.flags.outputs.platform }}
124-
build-args: |
125-
BUILD_ARCH=${{ matrix.architecture }}
126-
BUILD_DATE=${{ steps.flags.outputs.date }}
127-
BUILD_DESCRIPTION=${{ needs.information.outputs.description }}
128-
BUILD_NAME=${{ needs.information.outputs.name }}
129-
BUILD_REF=${{ github.sha }}
130-
BUILD_REPOSITORY=${{ github.repository }}
131-
BUILD_VERSION=${{ needs.information.outputs.version }}
132-
# yamllint disable rule:line-length
133-
- name: 🚀 Push
134-
run: |
135-
docker push \
136-
"ghcr.io/${{ steps.registry.outputs.owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.environment }}"
137-
docker push \
138-
"ghcr.io/${{ steps.registry.outputs.owner }}/${{ needs.information.outputs.slug }}/${{ matrix.architecture }}:${{ needs.information.outputs.version }}"
139-
# yamllint enable rule:line-length
140-
publish-edge:
141-
name: 📢 Publish to edge repository
142-
if: needs.information.outputs.environment == 'edge'
143-
needs:
144-
- information
145-
- deploy
146-
environment:
147-
name: ${{ needs.information.outputs.environment }}
148-
runs-on: ubuntu-latest
149-
steps:
150-
- name: 🚀 Dispatch update signal - homeassistant-apps/repository-edge
151-
uses: peter-evans/repository-dispatch@v4.0.1
152-
with:
153-
token: ${{ secrets.PAT_BRENNER_BOT }}
154-
repository: ${{ github.repository_owner }}/repository-edge
155-
event-type: update
156-
client-payload: >
157-
{
158-
"addon": "${{ needs.information.outputs.slug }}",
159-
"name": "${{ needs.information.outputs.name }}",
160-
"repository": "${{ github.repository }}",
161-
"version": "${{ needs.information.outputs.version }}"
162-
}
163-
- name: 🚀 Dispatch repository updater update signal - brenner-tobias/ha-addons-edge
164-
uses: peter-evans/repository-dispatch@v4.0.1
165-
with:
166-
token: ${{ secrets.PAT_BRENNER_BOT }}
167-
repository: brenner-tobias/ha-addons-edge
168-
event-type: update
169-
client-payload: >
170-
{
171-
"addon": "${{ needs.information.outputs.slug }}",
172-
"name": "${{ needs.information.outputs.name }}",
173-
"repository": "${{ github.repository }}",
174-
"version": "${{ needs.information.outputs.version }}"
175-
}
176-
177-
publish-stable:
178-
name: 📢 Publish to stable repository
179-
if: needs.information.outputs.environment == 'stable'
180-
needs:
181-
- information
182-
- deploy
183-
environment:
184-
name: ${{ needs.information.outputs.environment }}
185-
runs-on: ubuntu-latest
186-
steps:
187-
- name: 🚀 Dispatch repository updater update signal - homeassistant-apps/repository
188-
uses: peter-evans/repository-dispatch@v4.0.1
189-
with:
190-
token: ${{ secrets.PAT_BRENNER_BOT }}
191-
repository: ${{ github.repository_owner }}/repository
192-
event-type: update
193-
client-payload: >
194-
{
195-
"addon": "${{ needs.information.outputs.slug }}",
196-
"name": "${{ needs.information.outputs.name }}",
197-
"repository": "${{ github.repository }}",
198-
"version": "${{ github.event.release.tag_name }}"
199-
}
200-
- name: 🚀 Dispatch repository updater update signal - brenner-tobias/ha-addons
201-
uses: peter-evans/repository-dispatch@v4.0.1
202-
with:
203-
token: ${{ secrets.PAT_BRENNER_BOT }}
204-
repository: brenner-tobias/ha-addons
205-
event-type: update
206-
client-payload: >
207-
{
208-
"addon": "${{ needs.information.outputs.slug }}",
209-
"name": "${{ needs.information.outputs.name }}",
210-
"repository": "${{ github.repository }}",
211-
"version": "${{ github.event.release.tag_name }}"
212-
}
27+
uses: ./.github/workflows/upstream/deploy.yaml
28+
secrets: inherit
29+
with:
30+
event_name: ${{ github.event_name }}
31+
release_prerelease: ${{ github.event.release.prerelease || false }}
32+
release_tag_name: ${{ github.event.release.tag_name || '' }}

0 commit comments

Comments
 (0)