-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (54 loc) · 1.71 KB
/
Copy pathrelease.yml
File metadata and controls
65 lines (54 loc) · 1.71 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
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@v2
with:
tool: just
- name: Get version from tag
id: tag_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Check Cargo.toml version
run: |
# Read workspace version from [workspace.package] section
CARGO_VERSION=$(grep -A5 '^\[workspace\.package\]' Cargo.toml \
| grep '^version' \
| head -1 \
| sed 's/version = "\(.*\)"/\1/')
echo "Cargo version: $CARGO_VERSION"
echo "Tag version: ${{ env.VERSION }}"
if [ "$CARGO_VERSION" != "${{ env.VERSION }}" ]; then
echo "Error: Cargo.toml version ($CARGO_VERSION) does not match tag version (${{ env.VERSION }})"
exit 1
fi
- name: Generate Changelog
uses: orhun/git-cliff-action@v4
id: git-cliff
with:
config: cliff.toml
args: --verbose --latest --strip header
env:
OUTPUT: CHANGELOG.md
- name: Create Release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.git-cliff.outputs.content }}
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
- name: Publish to crates.io
run: just publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}