name: Release
on:
push:
tags: '*'
jobs:
build:
runs-on: ubuntu-24.04
permissions: {}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
persist-credentials: false
- name: Sanity checks
run: |
# GHA makes the tag point to the commit rather than the tag object.
# Remove the tag and fetch it again to get the real tag object.
git tag -d "$(echo "$GITHUB_REF" | sed 's/refs\/tags\///')"
git fetch https://github.com/trifectatechfoundation/sudo-rs.git --tags
# Check if the tag has a signature to prevent accidentally pushing an unsigned tag.
git tag -l --format='%(contents:signature)' "$(echo "$GITHUB_REF" | sed 's/refs\/tags\///')" | grep --quiet SIGNATURE || (echo "Tag not signed"; exit 1)
- name: Run build
run: ./util/build-release.sh
- name: Upload artifacts
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f with:
name: release_files
path: |
target/pkg/SHA256SUMS
target/pkg/*.tar.gz
- name: Compare checksums
run: |
# Get the expected checksums from the tag message.
git tag -l --format='%(contents:body)' "$(echo "$GITHUB_REF" | sed 's/refs\/tags\///')" | tr -s '\n' > expected_checksums.txt
# Check that the actual checksums match what we expected. If not fail
# the release and have the person doing the release check again for
# reproducibility problems.
cat expected_checksums.txt
diff -u expected_checksums.txt target/pkg/SHA256SUMS
release:
runs-on: ubuntu-24.04
permissions:
contents: write
needs: build
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd with:
persist-credentials: false
- name: Download artifacts
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 with:
name: release_files
path: release_files
- name: Prepare release
run: |
echo "Release files:"
ls -l release_files
echo
# Extract the first changelog entry from CHANGELOG.md
echo "Changelog:"
sed -n '4,${ /^## /q; p; }' CHANGELOG.md | tee changes.md
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
# GHA makes the tag point to the commit rather than the tag object.
# Remove the tag and fetch it again to get the real tag object.
RELEASE="$(echo "$GITHUB_REF" | sed 's/refs\/tags\///')"
git tag -d "$RELEASE"
git fetch https://github.com/trifectatechfoundation/sudo-rs.git --tags
gh release create "$RELEASE" --draft \
--title "Version ${RELEASE#v}" \
--notes-file changes.md release_files/* \
--verify-tag
echo "Draft release successfully created. Please review and publish."