Skip to content

Commit 9a6112d

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

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

.github/workflows/release.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ 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+
ARCH_LIST=$(nix run .#archs --quiet)
81+
echo "Generated Archs:"
82+
echo "$ARCH_LIST"
8183
echo "arch_list=$ARCH_LIST" >> $GITHUB_OUTPUT
8284
8385
build:
@@ -193,11 +195,6 @@ jobs:
193195
docker load < ./result
194196
docker tag grhooks:${{ env.VERSION }} ghcr.io/${{ env.REPOSITORY }}/grhooks:${{ matrix.arch }}
195197
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-
201198
docker-publish:
202199
runs-on: ubuntu-latest
203200
needs: [setup, generate-matrix, docker-build]
@@ -216,7 +213,7 @@ jobs:
216213
- name: Create and push manifest
217214
run: |
218215
IMAGE=ghcr.io/${{ env.REPOSITORY }}/grhooks:${{ env.VERSION }}
219-
ARCHS='${{ needs.generate-matrix.outputs.arch_list }}'
216+
ARCHS="${{ needs.generate-matrix.outputs.arch_list }}"
220217
221218
echo "Creating manifest for architectures: $ARCHS"
222219

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)