Skip to content

Commit 7589e9e

Browse files
committed
fix: remove old ci actions for migrated add-ons
1 parent 828efe0 commit 7589e9e

File tree

1 file changed

+54
-66
lines changed

1 file changed

+54
-66
lines changed

.github/workflows/ci.yml

Lines changed: 54 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ on:
66
workflow_dispatch:
77
inputs:
88
type:
9-
description: 'Type (edge/proxy)'
10-
default: 'edge'
9+
description: "Type (edge/proxy)"
10+
default: "edge"
1111
required: true
1212

1313
jobs:
@@ -18,34 +18,24 @@ jobs:
1818
ADDON_LIST: ${{ env.ADDON_LIST }}
1919
BUILD_ARGS: ${{ env.BUILD_ARGS }}
2020
steps:
21-
- uses: actions/checkout@v3
21+
- uses: actions/checkout@v3
2222

23-
- name: "ARGS: default"
24-
run: |
25-
echo "ADDON_LIST=['zigbee2mqtt', 'zigbee2mqtt-edge']" >> $GITHUB_ENV
26-
echo "BUILD_ARGS=--no-latest --test" >> $GITHUB_ENV
27-
- name: "ARGS: zigbee2mqtt-proxy" # Build of addon proxy version
28-
if: github.ref == 'refs/heads/master' && (github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'proxy')
29-
run: |
30-
echo "ADDON_LIST=['zigbee2mqtt-proxy']" >> $GITHUB_ENV
31-
echo "BUILD_ARGS=--no-cache" >> $GITHUB_ENV
32-
- name: "ARGS: zigbee2mqtt-edge" # Build of addon edge version
33-
if: github.ref == 'refs/heads/master' && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'edge'))
34-
run: |
35-
echo "ADDON_LIST=['zigbee2mqtt-edge']" >> $GITHUB_ENV
36-
echo "BUILD_ARGS=--no-cache" >> $GITHUB_ENV
37-
- name: "ARGS: zigbee2mqtt" # Build of addon release version
38-
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
39-
run: |
40-
echo "ADDON_LIST=['zigbee2mqtt']" >> $GITHUB_ENV
41-
echo "BUILD_ARGS=--no-cache --docker-hub-check" >> $GITHUB_ENV
23+
- name: "ARGS: default"
24+
run: |
25+
echo "ADDON_LIST=['zigbee2mqtt']" >> $GITHUB_ENV
26+
echo "BUILD_ARGS=--no-latest --test" >> $GITHUB_ENV
27+
- name: "ARGS: zigbee2mqtt" # Build of addon release version
28+
if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push'
29+
run: |
30+
echo "ADDON_LIST=['zigbee2mqtt']" >> $GITHUB_ENV
31+
echo "BUILD_ARGS=--no-cache --docker-hub-check" >> $GITHUB_ENV
4232
43-
- name: Determine arch
44-
id: determine_arch
45-
run: |
46-
ARCH_LIST=$(jq -r -c '.arch' ./${{ fromJSON(env.ADDON_LIST)[0] }}/config.json)
47-
echo "Found the following arches: $ARCH_LIST"
48-
echo "ARCH_LIST=$ARCH_LIST" >> $GITHUB_ENV
33+
- name: Determine arch
34+
id: determine_arch
35+
run: |
36+
ARCH_LIST=$(jq -r -c '.arch' ./${{ fromJSON(env.ADDON_LIST)[0] }}/config.json)
37+
echo "Found the following arches: $ARCH_LIST"
38+
echo "ARCH_LIST=$ARCH_LIST" >> $GITHUB_ENV
4939
5040
build:
5141
runs-on: ubuntu-latest
@@ -57,54 +47,52 @@ jobs:
5747
arch: ${{fromJSON(needs.variables.outputs.ARCH_LIST)}}
5848
addon: ${{fromJSON(needs.variables.outputs.ADDON_LIST)}}
5949
steps:
60-
- uses: actions/checkout@v3
50+
- uses: actions/checkout@v3
6151

62-
- name: Log in to docker.io
63-
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
64-
uses: docker/login-action@v3
65-
with:
52+
- name: Log in to docker.io
53+
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
54+
uses: docker/login-action@v3
55+
with:
6656
username: koenkk
6757
password: ${{ secrets.DOCKER_KEY }}
6858

69-
- name: Log in to ghcr.io
70-
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
71-
uses: docker/login-action@v3
72-
with:
59+
- name: Log in to ghcr.io
60+
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
61+
uses: docker/login-action@v3
62+
with:
7363
registry: ghcr.io
7464
username: koenkk
7565
password: ${{ secrets.GH_TOKEN }}
7666

77-
- name: Prepare data folder
78-
run: |
79-
if [ "${{ matrix.addon }}" != "zigbee2mqtt-proxy" ]; then
67+
- name: Prepare data folder
68+
run: |
8069
cp -R common/rootfs ${{ matrix.addon }}
8170
cp common/Dockerfile ${{ matrix.addon }}
82-
fi
83-
cp common/build.yaml ${{ matrix.addon }}
71+
cp common/build.yaml ${{ matrix.addon }}
8472
85-
- name: Build
86-
uses: home-assistant/builder@master
87-
# Note: if running without `--test`, image is pushed to docker.io
88-
with:
89-
args: |
90-
--${{ matrix.arch }} \
91-
--target ${{ matrix.addon }} \
92-
${{ env.BUILD_ARGS }}
73+
- name: Build
74+
uses: home-assistant/builder@master
75+
# Note: if running without `--test`, image is pushed to docker.io
76+
with:
77+
args: |
78+
--${{ matrix.arch }} \
79+
--target ${{ matrix.addon }} \
80+
${{ env.BUILD_ARGS }}
9381
94-
# Keep pushing to docker.io as it is unclear how
95-
# HA handles config.json updates (especially for the unversioned edge)
96-
- name: Push to docker.io
97-
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
98-
run: |
99-
CONFIG_IMAGE=$(cat ${{ matrix.addon }}/config.json | jq -r '.image | sub("{arch}"; "${{ matrix.arch }}")')
100-
CONFIG_VERSION=$(cat ${{ matrix.addon }}/config.json | jq -r .version)
82+
# Keep pushing to docker.io as it is unclear how
83+
# HA handles config.json updates (especially for the unversioned edge)
84+
- name: Push to docker.io
85+
if: (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
86+
run: |
87+
CONFIG_IMAGE=$(cat ${{ matrix.addon }}/config.json | jq -r '.image | sub("{arch}"; "${{ matrix.arch }}")')
88+
CONFIG_VERSION=$(cat ${{ matrix.addon }}/config.json | jq -r .version)
10189
102-
VERSIONS=("latest" "$CONFIG_VERSION")
103-
for VERSION in "${VERSIONS[@]}"; do
104-
GHCR_IMAGE="$CONFIG_IMAGE:$CONFIG_VERSION"
105-
DOCKER_IO_IMAGE=$(echo "$GHCR_IMAGE" | sed 's|ghcr\.io\/||')
106-
echo "Push: $GHCR_IMAGE -> $DOCKER_IO_IMAGE"
107-
docker pull $GHCR_IMAGE
108-
docker tag $GHCR_IMAGE $DOCKER_IO_IMAGE
109-
docker push $DOCKER_IO_IMAGE
110-
done
90+
VERSIONS=("latest" "$CONFIG_VERSION")
91+
for VERSION in "${VERSIONS[@]}"; do
92+
GHCR_IMAGE="$CONFIG_IMAGE:$CONFIG_VERSION"
93+
DOCKER_IO_IMAGE=$(echo "$GHCR_IMAGE" | sed 's|ghcr\.io\/||')
94+
echo "Push: $GHCR_IMAGE -> $DOCKER_IO_IMAGE"
95+
docker pull $GHCR_IMAGE
96+
docker tag $GHCR_IMAGE $DOCKER_IO_IMAGE
97+
docker push $DOCKER_IO_IMAGE
98+
done

0 commit comments

Comments
 (0)