-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (58 loc) · 2.03 KB
/
ci.yml
File metadata and controls
62 lines (58 loc) · 2.03 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
name: CI
on:
push:
branches: [main, master]
tags: ["v*"]
pull_request:
branches: [main, master]
workflow_dispatch:
permissions:
contents: read
jobs:
ci:
uses: runcycles/.github/.github/workflows/ci-rust.yml@v1
with:
rust-versions: '["stable", "1.88"]'
cargo-args: '--all-features'
publish:
name: Publish to crates.io
needs: ci
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
concurrency:
group: crates-publish
cancel-in-progress: false
permissions:
contents: write # required to create the GitHub Release
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable @ 2026-05-02
- name: Publish to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- name: Extract changelog notes
id: changelog
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
# Extract the section between "## [VERSION]" and the next "## [".
# Strip leading blank line and trailing whitespace.
awk -v ver="$VERSION" '
$0 ~ "^## \\[" ver "\\]" { found=1; next }
found && /^## \[/ { exit }
found { print }
' CHANGELOG.md | awk 'NF || found { found=1; print }' > /tmp/release-notes.md
if [ ! -s /tmp/release-notes.md ]; then
echo "::warning::No CHANGELOG entry found for $VERSION; release will use a placeholder body."
echo "Release of v$VERSION. See CHANGELOG.md for details." > /tmp/release-notes.md
fi
echo "----- Release notes for v$VERSION -----"
cat /tmp/release-notes.md
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${GITHUB_REF#refs/tags/v}"
gh release create "v$VERSION" \
--title "v$VERSION" \
--notes-file /tmp/release-notes.md