name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
publish:
if: github.repository == 'kabudu/telosieve'
environment: crates-io
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Check out tagged source
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 with:
persist-credentials: false
- name: Install pinned Rust toolchain
run: rustup toolchain install 1.97.0 --profile minimal && rustup override set 1.97.0
- name: Verify tag and release presentation
run: |
VERSION=$(python3 -c 'import tomllib; print(tomllib.load(open("Cargo.toml", "rb"))["package"]["version"])')
test "$GITHUB_REF_NAME" = "v$VERSION"
python3 scripts/validate-release-metadata.py
python3 scripts/validate-release-presentation.py
cargo package --locked
- name: Publish crate
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --locked
- name: Build release binary
run: |
cargo build --locked --release
cp target/release/telosieve target/telosieve-x86_64-unknown-linux-gnu
sha256sum target/telosieve-x86_64-unknown-linux-gnu > target/telosieve-x86_64-unknown-linux-gnu.sha256
- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION=${GITHUB_REF_NAME#v}
TITLE=$(head -1 "RELEASE_NOTES_v${VERSION}.md" | sed 's/^# //')
tail -n +3 "RELEASE_NOTES_v${VERSION}.md" > target/github-release-notes.md
gh release create "$GITHUB_REF_NAME" target/telosieve-x86_64-unknown-linux-gnu target/telosieve-x86_64-unknown-linux-gnu.sha256 --verify-tag --prerelease --title "$TITLE" --notes-file target/github-release-notes.md