|
| 1 | +# SPDX-License-Identifier: Apache-2.0 |
| 2 | +# Copyright (c) Contributors to the OpenImageIO Project. |
| 3 | + |
| 4 | +# |
| 5 | +# Releases are signed via https://github.com/sigstore/sigstore-python. |
| 6 | +# See https://docs.sigstore.dev for information about sigstore. |
| 7 | +# |
| 8 | +# This action creates a .tar.gz of the complete OpenImageIO source tree at |
| 9 | +# the given release tag, signs it via sigstore, and uploads the |
| 10 | +# .tar.gz and the associated .tar.gz.sigstore credential bundle. |
| 11 | +# |
| 12 | +# To verify a downloaded release at a given tag: |
| 13 | +# |
| 14 | +# % pip install sigstore |
| 15 | +# % sigstore verify github --cert-identity https://github.com/AcademySoftwareFoundation/OpenImageIO/.github/workflows/release-sign.yml@refs/tags/<tag> OpenImageIO-<tag>.tar.gz |
| 16 | +# |
| 17 | + |
| 18 | +name: Sign Release |
| 19 | + |
| 20 | +on: |
| 21 | + release: |
| 22 | + types: [published] |
| 23 | + |
| 24 | +permissions: |
| 25 | + contents: read |
| 26 | + |
| 27 | +jobs: |
| 28 | + release: |
| 29 | + name: Sign & upload release artifacts |
| 30 | + runs-on: ubuntu-latest |
| 31 | + |
| 32 | + env: |
| 33 | + TAG: ${{ github.ref_name }} |
| 34 | + permissions: |
| 35 | + contents: write |
| 36 | + id-token: write |
| 37 | + repository-projects: write |
| 38 | + |
| 39 | + steps: |
| 40 | + |
| 41 | + - name: Set Prefix |
| 42 | + # The tag name begins with a 'v', e.g. "v3.0.3", but the prefix |
| 43 | + # should omit the 'v', so the tarball "OpenImageIO-3.0.3.tar.gz" |
| 44 | + # extracts files into "OpenImageIO-v3.0.3/...". This matches |
| 45 | + # the GitHub release page autogenerated artifact conventions. |
| 46 | + run: | |
| 47 | + echo OPENIMAGEIO_PREFIX=OpenImageIO-${TAG//v}/ >> $GITHUB_ENV |
| 48 | + echo OPENIMAGEIO_TARBALL=OpenImageIO-${TAG//v}.tar.gz >> $GITHUB_ENV |
| 49 | + shell: bash |
| 50 | + |
| 51 | + - name: Checkout |
| 52 | + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 53 | + |
| 54 | + - name: Create archive |
| 55 | + run: git archive --format=tar.gz -o ${OPENIMAGEIO_TARBALL} --prefix ${OPENIMAGEIO_PREFIX} ${TAG} |
| 56 | + |
| 57 | + - name: Sign archive with Sigstore |
| 58 | + uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46 # v3.0.0 |
| 59 | + with: |
| 60 | + inputs: ${{ env.OPENIMAGEIO_TARBALL }} |
| 61 | + upload-signing-artifacts: false |
| 62 | + release-signing-artifacts: false |
| 63 | + |
| 64 | + - name: Upload release archive |
| 65 | + env: |
| 66 | + GH_TOKEN: ${{ github.token }} |
| 67 | + run: gh release upload ${TAG} ${OPENIMAGEIO_TARBALL} ${OPENIMAGEIO_TARBALL}.sigstore.json |
0 commit comments