From 4ff2b2ad8cff6253b40cb634c9f0df185ac2c53e Mon Sep 17 00:00:00 2001 From: Anton Dukhovnikov Date: Mon, 20 Jul 2026 15:59:36 +1200 Subject: [PATCH] add signed release action Signed-off-by: Anton Dukhovnikov --- .github/workflows/release-sign.yml | 76 ++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/release-sign.yml diff --git a/.github/workflows/release-sign.yml b/.github/workflows/release-sign.yml new file mode 100644 index 0000000..fd7e4b6 --- /dev/null +++ b/.github/workflows/release-sign.yml @@ -0,0 +1,76 @@ +# SPDX-License-Identifier: Apache-2.0 +# Copyright Contributors to the rawtoaces project. + +# +# Releases are signed via https://github.com/sigstore/sigstore-python. +# See https://docs.sigstore.dev for information about sigstore. +# +# This action creates a .tar.gz of the complete rawtoaces-data source tree at +# the given release tag, signs it via sigstore, and uploads the +# .tar.gz and the associated .tar.gz.sigstore credential bundle. +# +# To verify a downloaded release at a given tag: +# +# % pip install sigstore +# % sigstore verify github --cert-identity https://github.com/AcademySoftwareFoundation/rawtoaces-data/.github/workflows/release-sign.yml@refs/tags/ rawtoaces-data-.tar.gz +# +# To sign an existing release after publish (e.g. workflow fix): Actions → +# Sign Release → Run workflow → enter the release tag (e.g. v3.2.8). + +name: Sign Release + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: "Release tag to sign (e.g. v3.2.8)" + required: true + type: string + +permissions: + contents: read + +jobs: + release: + name: Sign & upload release artifacts + runs-on: ubuntu-latest + + env: + TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }} + permissions: + contents: write # required for gh release upload (attach assets) + id-token: write # required for sigstore OIDC signing + steps: + + - name: Set Prefix + # The tag name begins with a 'v', e.g. "v3.2.4", but the prefix + # should omit the 'v', so the tarball "rawtoaces-data-3.2.4.tar.gz" + # extracts files into "rawtoaces-data-v3.2.4/...". This matches + # the GitHub release page autogenerated artifact conventions. + run: | + echo RAWTOACES_DATA_PREFIX=rawtoaces-data-${TAG//v}/ >> $GITHUB_ENV + echo RAWTOACES_DATA_TARBALL=rawtoaces-data-${TAG//v}.tar.gz >> $GITHUB_ENV + shell: bash + + - name: Checkout + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }} + + - name: Create archive + run: git archive --format=tar.gz -o ${RAWTOACES_DATA_TARBALL} --prefix ${RAWTOACES_DATA_PREFIX} ${TAG} + + - name: Sign archive with Sigstore + uses: sigstore/gh-action-sigstore-python@5b79a39c381910c090341a2c9b0bf022c8b387e1 # v3.4.0 + with: + inputs: ${{ env.RAWTOACES_DATA_TARBALL }} + upload-signing-artifacts: false + release-signing-artifacts: false + + - name: Upload release archive + env: + GH_TOKEN: ${{ github.token }} + run: gh release upload ${TAG} ${RAWTOACES_DATA_TARBALL} ${RAWTOACES_DATA_TARBALL}.sigstore.json +