From afccb705d4bdd5f120ac525a44c60c64d69d3bc6 Mon Sep 17 00:00:00 2001 From: Pollora maintainer Date: Thu, 3 Dec 2026 17:12:57 +0100 Subject: [PATCH] ci: publish module.sha256 with each release --- .github/workflows/checksum.yml | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/checksum.yml diff --git a/.github/workflows/checksum.yml b/.github/workflows/checksum.yml new file mode 100644 index 0000000..f75939f --- /dev/null +++ b/.github/workflows/checksum.yml @@ -0,0 +1,45 @@ +name: Release checksum + +# Publishes the SHA-256 of the tag archive as the release asset `module.sha256`, which the +# `pollora:make:*` commands check before they extract a download (Pollora 13.45.1+). + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: Tag of an existing release + required: true + type: string + +permissions: {} + +jobs: + checksum: + name: module.sha256 + runs-on: ubuntu-latest + permissions: + contents: write + env: + GH_TOKEN: ${{ github.token }} + REPO: ${{ github.repository }} + TAG: ${{ inputs.tag || github.event.release.tag_name }} + steps: + - name: Publish the checksum of the tag archive + run: | + set -euo pipefail + + assets="$(gh release view "$TAG" --repo "$REPO" --json assets --jq '.assets[].name')" + if grep -qx 'module.sha256' <<< "$assets"; then + echo "module.sha256 is already published for $TAG: left as it is." + exit 0 + fi + + url="https://github.com/$REPO/archive/refs/tags/$TAG.zip" + curl -fsSL --retry 3 "$url" -o first.zip + curl -fsSL --retry 3 "$url" -o second.zip + cmp first.zip second.zip + + printf '%s %s.zip\n' "$(sha256sum first.zip | cut -d' ' -f1)" "$TAG" > module.sha256 + gh release upload "$TAG" module.sha256 --repo "$REPO"