From 0a18608ea743290e63755a8ba857c26a5be0cc8d Mon Sep 17 00:00:00 2001 From: Larry Gritz Date: Wed, 1 Jan 2025 20:55:05 -0800 Subject: [PATCH] admin: Sign release artifacts Closes 1857 Same approach that was taken by OpenEXR and OpenImageIO. Signed-off-by: Larry Gritz --- .github/workflows/release-sign.yml | 67 ++++++++++++++++++++++++++++++ 1 file changed, 67 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 000000000..c21e94526 --- /dev/null +++ b/.github/workflows/release-sign.yml @@ -0,0 +1,67 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) Contributors to the Open Shading Language 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 OSL 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/OpenShadingLanguage/.github/workflows/release-sign.yml@refs/tags/ OSL-.tar.gz +# + +name: Sign Release + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + release: + name: Sign & upload release artifacts + runs-on: ubuntu-latest + + env: + TAG: ${{ github.ref_name }} + permissions: + contents: write + id-token: write + repository-projects: write + + steps: + + - name: Set Prefix + # The tag name begins with a 'v', e.g. "v1.14.3", but the prefix + # should omit the 'v', so the tarball "OSL-1.14.3.tar.gz" + # extracts files into "OSL-v1.14.3/...". This matches + # the GitHub release page autogenerated artifact conventions. + run: | + echo OSL_PREFIX=OSL-${TAG//v}/ >> $GITHUB_ENV + echo OSL_TARBALL=OSL-${TAG//v}.tar.gz >> $GITHUB_ENV + shell: bash + + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Create archive + run: git archive --format=tar.gz -o ${OSL_TARBALL} --prefix ${OSL_PREFIX} ${TAG} + + - name: Sign archive with Sigstore + uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46 # v3.0.0 + with: + inputs: ${{ env.OSL_TARBALL }} + upload-signing-artifacts: false + release-signing-artifacts: false + + - name: Upload release archive + env: + GH_TOKEN: ${{ github.token }} + run: gh release upload ${TAG} ${OSL_TARBALL} ${OSL_TARBALL}.sigstore.json