Skip to content

Commit 724af49

Browse files
Add release workflow
1 parent 45b7aae commit 724af49

File tree

1 file changed

+77
-2
lines changed

1 file changed

+77
-2
lines changed

.github/workflows/release.yml

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,82 @@
11
name: Release
22

33
on:
4-
release:
5-
types: [created]
4+
workflow_dispatch:
5+
inputs:
6+
bump:
7+
description: 'Bump version by semver keyword.'
8+
required: true
9+
type: choice
10+
options:
11+
- patch
12+
- minor
13+
- major
614

715
jobs:
16+
release:
17+
name: Release
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- name: Generate GitHub App token
22+
id: app-token
23+
uses: getsentry/action-github-app-token@v3
24+
with:
25+
app_id: ${{ secrets.APP_ID }}
26+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
27+
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Rust toolchain
32+
run: rustup toolchain install nightly --no-self-update --profile default
33+
34+
- name: Set up Rust cache
35+
uses: swatinem/rust-cache@v2
36+
with:
37+
cache-on-failure: true
38+
save-if: ${{ github.ref == 'refs/heads/main' }}
39+
40+
- name: Install Cargo Binary Install
41+
uses: cargo-bins/cargo-binstall@main
42+
43+
- name: Install crates
44+
run: cargo binstall --force -y cargo-workspaces toml-cli
45+
46+
- name: Bump version
47+
run: cargo workspaces version --all --no-git-commit --yes ${{ inputs.bump }}
48+
49+
- name: Extract version
50+
id: extract-version
51+
run: echo "VERSION=v$(toml get Cargo.toml workspace.package.version --raw)" >> "$GITHUB_OUTPUT"
52+
53+
- name: Add changes
54+
run: git add .
55+
56+
- name: Commit
57+
uses: dsanders11/github-app-commit-action@v1
58+
with:
59+
message: ${{ steps.extract-version.outputs.VERSION }}
60+
token: ${{ steps.app-token.outputs.token }}
61+
62+
- name: Tag
63+
uses: bruno-fs/[email protected]
64+
with:
65+
tag: ${{ steps.extract-version.outputs.VERSION }}
66+
env:
67+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
68+
69+
- name: Release
70+
uses: softprops/action-gh-release@v2
71+
with:
72+
generate_release_notes: true
73+
make_latest: true
74+
tag_name: ${{ steps.extract-version.outputs.VERSION }}
75+
token: ${{ steps.app-token.outputs.token }}
76+
77+
- name: Publish
78+
run: cargo workspaces publish --publish-as-is --token "${{ secrets.CRATES_IO_TOKEN }}"
79+
880
release-binary:
981
strategy:
1082
fail-fast: false
@@ -35,8 +107,11 @@ jobs:
35107
os: macos-latest
36108
- target: x86_64-pc-windows-msvc
37109
os: windows-latest
110+
38111
runs-on: ${{ matrix.os }}
39112
name: Release ${{ matrix.package }} for ${{ matrix.target }}
113+
needs: release
114+
40115
steps:
41116
- uses: actions/checkout@v4
42117

0 commit comments

Comments
 (0)