Skip to content

Commit 0560007

Browse files
committed
ci: export unique arch list generated
1 parent f8a096a commit 0560007

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,12 @@ jobs:
7777
echo "$MATRIX"
7878
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
7979
80-
ARCH_LIST=$(echo "$MATRIX" | jq -r '.[].arch' | jq -R -s -c 'split("\n") | map(select(. != ""))')
80+
- name: Generate Arch List
81+
id: generate-arch-list
82+
run: |
83+
ARCH_LIST=$(nix run .#archs --quiet)
84+
echo "Generated Archs:"
85+
echo "$ARCH_LIST"
8186
echo "arch_list=$ARCH_LIST" >> $GITHUB_OUTPUT
8287
8388
build:
@@ -173,7 +178,7 @@ jobs:
173178
strategy:
174179
fail-fast: false
175180
matrix:
176-
include: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
181+
include: ${{ fromJson(needs.generate-arch-list.outputs.arch_list) }}
177182
steps:
178183
- uses: actions/checkout@v4
179184
- name: Set Repository Lowercase
@@ -193,16 +198,12 @@ jobs:
193198
docker load < ./result
194199
docker tag grhooks:${{ env.VERSION }} ghcr.io/${{ env.REPOSITORY }}/grhooks:${{ matrix.arch }}
195200
196-
- name: Create and push unified manifest
197-
run: |
198-
docker manifest create ghcr.io/${{ env.REPOSITORY }}/grhooks:${{ env.VERSION }} \
199-
--amend ghcr.io/${{ env.REPOSITORY }}/grhooks:${{ matrix.arch }}
200-
201201
docker-publish:
202202
runs-on: ubuntu-latest
203203
needs: [setup, generate-matrix, docker-build]
204204
env:
205205
VERSION: ${{ needs.setup.outputs.version }}
206+
ARCHS: ${{ needs.generate-arch-list.outputs.arch_list }}
206207
steps:
207208
- name: Log in to GHCR
208209
uses: docker/login-action@v3
@@ -216,7 +217,6 @@ jobs:
216217
- name: Create and push manifest
217218
run: |
218219
IMAGE=ghcr.io/${{ env.REPOSITORY }}/grhooks:${{ env.VERSION }}
219-
ARCHS='${{ needs.generate-matrix.outputs.arch_list }}'
220220
221221
echo "Creating manifest for architectures: $ARCHS"
222222

flake.nix

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@
108108
else ".#toTarball";
109109
}) formats
110110
) architectures));
111+
112+
archList = uniqueBy (i: i.arch) architectures;
113+
generatedArchJson = builtins.toJSON archList;
111114
in
112115
{
113116
devShells = lib.listToAttrs (map ({ arch, os, target, ... }: {
@@ -128,9 +131,7 @@
128131
}) architectures)) // (pkgs.lib.listToAttrs (map ({arch, ...} @ args: {
129132
name = "image-${arch}";
130133
value = containerPkg args;
131-
})
132-
(uniqueBy (i: i.arch) architectures)
133-
));
134+
}) archList));
134135

135136
apps = {
136137
help = {
@@ -163,6 +164,14 @@
163164
echo '${generatedMatrixJson}'
164165
'');
165166
};
167+
168+
archs = {
169+
type = "app";
170+
program = toString (pkgs.writeScript "generate-arch-list" ''
171+
#!/bin/sh
172+
echo '${generatedArchJson}'
173+
'');
174+
};
166175
};
167176

168177
bundlers = let

0 commit comments

Comments
 (0)