fix iso generation in gite actions
This commit is contained in:
@@ -40,29 +40,40 @@ jobs:
|
||||
download-buffer-size = 200000000
|
||||
auto-optimise-store = true
|
||||
|
||||
- name: Build ${{ matrix.host }} ISO
|
||||
- name: Build ${{ matrix.host }} ISO (nixos-generators)
|
||||
run: |
|
||||
nix build \
|
||||
.#nixosConfigurations.${{ matrix.host }}-iso.config.system.build.isoImage \
|
||||
--print-build-logs \
|
||||
--out-link iso-result
|
||||
nix run github:nix-community/nixos-generators -- \
|
||||
-f iso \
|
||||
--flake .#${{ matrix.host }}-iso \
|
||||
-o iso-result
|
||||
|
||||
- name: Show ${{ matrix.host }} ISO info
|
||||
run: |
|
||||
ISO_SRC=$(find iso-result -name '*.iso' -type f | head -n 1)
|
||||
if [ -z "$ISO_SRC" ]; then
|
||||
echo "No ISO found under iso-result"
|
||||
find iso-result -maxdepth 3 -type f
|
||||
exit 1
|
||||
fi
|
||||
echo "ISO built successfully:"
|
||||
ls -lh iso-result/iso/
|
||||
ls -lh "$ISO_SRC"
|
||||
echo ""
|
||||
echo "SHA256:"
|
||||
sha256sum iso-result/iso/*.iso
|
||||
sha256sum "$ISO_SRC"
|
||||
|
||||
- name: Prepare ${{ matrix.host }} ISO artifact (split if needed)
|
||||
run: |
|
||||
set -euo pipefail
|
||||
mkdir -p iso-result/artifact
|
||||
ISO_SRC=$(ls iso-result/iso/*.iso)
|
||||
ISO_SRC=$(find iso-result -name '*.iso' -type f | head -n 1)
|
||||
if [ -z "$ISO_SRC" ]; then
|
||||
echo "No ISO found under iso-result"
|
||||
find iso-result -maxdepth 3 -type f
|
||||
exit 1
|
||||
fi
|
||||
ISO_BASENAME="${{ matrix.host }}-installer.iso"
|
||||
ISO_DEST="iso-result/artifact/${ISO_BASENAME}"
|
||||
mv "$ISO_SRC" "$ISO_DEST"
|
||||
cp "$ISO_SRC" "$ISO_DEST"
|
||||
|
||||
SIZE=$(stat -c%s "$ISO_DEST")
|
||||
if [ "$SIZE" -gt 240000000 ]; then
|
||||
@@ -71,18 +82,18 @@ jobs:
|
||||
sha256sum "$ISO_DEST" > "${ISO_DEST}.sha256"
|
||||
rm "$ISO_DEST"
|
||||
cat > "iso-result/artifact/README.txt" <<EOF
|
||||
Reassemble:
|
||||
cat ${ISO_BASENAME}.part-* > ${ISO_BASENAME}
|
||||
Verify:
|
||||
sha256sum -c ${ISO_BASENAME}.sha256
|
||||
EOF
|
||||
else
|
||||
sha256sum "$ISO_DEST" > "${ISO_DEST}.sha256"
|
||||
fi
|
||||
|
||||
- name: Upload ${{ matrix.host }} ISO artifact
|
||||
if: ${{ github.event_name != 'workflow_dispatch' || inputs.upload-artifact }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.host }}-installer-iso
|
||||
path: iso-result/artifact/**
|
||||
Reassemble:
|
||||
cat ${ISO_BASENAME}.part-* > ${ISO_BASENAME}
|
||||
Verify:
|
||||
sha256sum -c ${ISO_BASENAME}.sha256
|
||||
EOF
|
||||
else
|
||||
sha256sum "$ISO_DEST" > "${ISO_DEST}.sha256"
|
||||
fi
|
||||
|
||||
- name: Upload ${{ matrix.host }} ISO artifact
|
||||
if: ${{ github.event_name != 'workflow_dispatch' || inputs.upload-artifact }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.host }}-installer-iso
|
||||
path: iso-result/artifact/**
|
||||
|
||||
Reference in New Issue
Block a user