Repository navigation
68 lines (59 loc) · 2.24 KB
/
Copy pathrelease.yml
File metadata and controls
68 lines (59 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Release
on:
push:
tags:
- 'v*.*.*'
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install Rust toolchains (stable, MSRV 1.95, nightly + miri/rust-src)
run: |
rustup toolchain install stable --profile minimal --component clippy
rustup toolchain install 1.95.0 nightly --profile minimal
rustup default stable
rustup component add --toolchain nightly miri rust-src llvm-tools-preview
rustup target add --toolchain stable aarch64-unknown-linux-gnu
cargo +nightly miri setup
- name: Install system dependencies and release gate tools
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config python3
cargo install --locked cargo-fuzz cargo-audit cargo-deny
# Fails before the long gate if CHANGELOG.md has no section for this tag.
- name: Extract release notes from CHANGELOG.md
run: |
version="${GITHUB_REF_NAME#v}"
awk -v hdr="## [${version}]" '
index($0, hdr) == 1 { found = 1; next }
found && /^## \[/ { exit }
found { print }
' CHANGELOG.md > "$RUNNER_TEMP/release_notes.md"
if ! grep -q '[^[:space:]]' "$RUNNER_TEMP/release_notes.md"; then
echo "::error::CHANGELOG.md has no non-empty '## [${version}]' section"
exit 1
fi
- name: Run authoritative pre-publish gate (Rule F4)
run: make release_prep
# Works whether or not the release already exists (created by hand, or a re-run).
- name: Create or update GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
notes="$RUNNER_TEMP/release_notes.md"
title="Release ${GITHUB_REF_NAME}"
if gh release view "${GITHUB_REF_NAME}" >/dev/null 2>&1; then
gh release edit "${GITHUB_REF_NAME}" --title "${title}" --notes-file "${notes}"
else
gh release create "${GITHUB_REF_NAME}" --verify-tag --title "${title}" --notes-file "${notes}"
fi