| 1 |
# SPDX-License-Identifier: BSD-3-Clause |
| 2 |
# Copyright (c) Contributors to the OpenEXR 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 Imath 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/Imath/.github/workflows/release-sign.yml@refs/tags/<tag> Imath-<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 |
- name: Set Prefix |
| 41 |
# The tag name begins with a 'v', e.g. "v3.2.4", but the prefix |
| 42 |
# should omit the 'v', so the tarball "Imath-3.2.4.tar.gz" |
| 43 |
# extracts files into "Imath-v3.2.4/...". This matches |
| 44 |
# the GitHub release page autogenerated artifact conventions. |
| 45 |
run: | |
| 46 |
echo IMATH_PREFIX=Imath-${TAG//v}/ >> $GITHUB_ENV |
| 47 |
echo IMATH_TARBALL=Imath-${TAG//v}.tar.gz >> $GITHUB_ENV |
| 48 |
shell: bash |
| 49 |
|
| 50 |
- name: Checkout |
| 51 |
uses: actions/checkout@v2 |
| 52 |
|
| 53 |
- name: Create archive |
| 54 |
run: git archive --format=tar.gz -o ${IMATH_TARBALL} --prefix ${IMATH_PREFIX} ${TAG} |
| 55 |
|
| 56 |
- name: Sign archive with Sigstore |
| 57 |
uses: sigstore/[email protected] |
| 58 |
with: |
| 59 |
inputs: ${{ env.IMATH_TARBALL }} |
| 60 |
|
| 61 |
- name: Upload release archive |
| 62 |
env: |
| 63 |
GH_TOKEN: ${{ github.token }} |
| 64 |
run: gh release upload ${{ github.ref_name }} ${IMATH_TARBALL} ${IMATH_TARBALL}.sigstore |
| 65 |
|