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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-*"
permissions:
contents: write
pull-requests: read
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with:
fetch-depth: 0
- name: Install Rust
run: rustup toolchain install 1.89.0 --profile minimal && rustup default 1.89.0
- name: Resolve version from tag
id: plan
run: |
TAG="${GITHUB_REF_NAME}"
VERSION="${TAG#v}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Bump crate version
run: |
cargo install cargo-edit --locked
cargo set-version "${{ steps.plan.outputs.version }}"
cargo update --offline || cargo update
- name: Install git-cliff
uses: taiki-e/install-action@8f531eaecd1898bc3da7d104ad91bee98d1b97bd
with:
tool: git-cliff
- name: Generate CHANGELOG
env:
GITHUB_TOKEN: ${{ github.token }}
run: git-cliff --config cliff.toml --tag "${{ steps.plan.outputs.tag }}" --output CHANGELOG.md
- name: Commit version bump and changelog
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
DEFAULT_BRANCH="$(git remote show origin | sed -n 's/.*HEAD branch: //p')"
git add -A
git diff --cached --quiet || git commit -m "chore(release): ${{ steps.plan.outputs.tag }}"
git push origin "HEAD:${DEFAULT_BRANCH}" || true
- name: Extract release notes
id: notes
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
{
echo 'body<<EOF'
git-cliff --config cliff.toml --latest --strip all
echo 'EOF'
} >> "$GITHUB_OUTPUT"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release delete "${{ github.ref_name }}" --yes 2>/dev/null || true
gh release create "${{ github.ref_name }}" \
--title "${{ github.ref_name }}" \
--notes "${{ steps.notes.outputs.body }}" \
--latest
- name: Send GitHub Release to Discord
uses: SethCohen/github-releases-to-discord@24d166886aee4646d448c8a389ff9e1ebcab3682
with:
webhook_url: ${{ secrets.DISCORD }}
release_name: ${{ github.ref_name }}
release_body: ${{ steps.notes.outputs.body }}
release_html_url: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}
color: "3447003"
username: "GitHub Releases"
avatar_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
content: "New omnitrack-rs release published."
footer_title: "akira-io/omnitrack-rs"
footer_icon_url: "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png"
footer_timestamp: true