From 7066549ee67ca60990b4e049c20fa195dda3edee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 4 Aug 2023 22:47:00 +0200 Subject: [PATCH 1/2] update assets more atomically --- build-images.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/build-images.sh b/build-images.sh index 84ab99a..ec2301c 100755 --- a/build-images.sh +++ b/build-images.sh @@ -6,7 +6,7 @@ shopt -s lastpipe build_netboot_image() { declare -r tag=$1 arch=$2 tmp=$3 - img=$(nix build --print-out-paths --option accept-flake-config true -L ".#packages.${arch}.netboot-${tag//.}") + img=$(nix build --print-out-paths --option accept-flake-config true -L ".#packages.${arch}.netboot-${tag//./}") ln -s "$img/bzImage" "$tmp/bzImage-$arch" echo "$tmp/bzImage-$arch" ln -s "$img/initrd" "$tmp/initrd-$arch" @@ -14,14 +14,14 @@ build_netboot_image() { sed -e "s!^kernel bzImage!kernel https://github.com/nix-community/nixos-images/releases/download/${tag}/bzImage-${arch}!" \ -e "s!^initrd initrd!initrd https://github.com/nix-community/nixos-images/releases/download/${tag}/initrd-${arch}!" \ -e "s!initrd=initrd!initrd=initrd-${arch}!" \ - < "$img/netboot.ipxe" \ - > "$tmp/netboot-$arch.ipxe" + <"$img/netboot.ipxe" \ + >"$tmp/netboot-$arch.ipxe" echo "$tmp/netboot-$arch.ipxe" } build_kexec_installer() { declare -r tag=$1 arch=$2 tmp=$3 variant=$4 - out=$(nix build --print-out-paths --option accept-flake-config true -L ".#packages.${arch}.kexec-installer-${tag//.}${variant}") + out=$(nix build --print-out-paths --option accept-flake-config true -L ".#packages.${arch}.kexec-installer-${tag//./}${variant}") echo "$out/nixos-kexec-installer${variant}-$arch.tar.gz" } @@ -36,14 +36,22 @@ main() { ) | readarray -t assets for asset in "${assets[@]}"; do pushd "$(dirname "$asset")" - sha256sum "$(basename "$asset")" >> "$TMP/sha256sums" + sha256sum "$(basename "$asset")" >>"$TMP/sha256sums" popd done assets+=("$TMP/sha256sums") - # Since we cannot atomically update a release, we delete the old one before - gh release delete "$tag" "$TMP/existing-assets" + + for asset in "${assets[@]}"; do + basename "$asset" >>"$TMP/uploaded-assets" + done + sort "$TMP/uploaded-assets" "$TMP/existing-assets" | uniq -u | xargs --no-run-if-empty -I{} gh release delete-asset --yes "$tag" {} } main "$@" From 3b4624dc1a9bcfa5c3b516e2f95621ff9139d4f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 4 Aug 2023 22:47:51 +0200 Subject: [PATCH 2/2] build-images: reformat with shellfmt --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38c5208..cf84488 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ jobs: - nixos-23.05 - nixos-unstable os: - #- nscloud-ubuntu-22.04-arm64-4x16 + - nscloud-ubuntu-22.04-arm64-4x16 - ubuntu-latest runs-on: ${{ matrix.os }} steps: