generated from tktcorporation/.github
-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (39 loc) · 1.23 KB
/
bump-update-release.yml
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
name: Bump Update and Release
on:
workflow_dispatch:
inputs:
bump_type:
description: 'Bump type (patch or minor)'
required: true
default: 'patch'
jobs:
build_and_update_version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
default: true
- name: Install cargo-edit
run: cargo install cargo-edit
- name: Update version in Cargo.toml
run: cargo set-version --bump ${{ github.event.inputs.bump_type }}
- name: Build the project
run: cargo build --release
- name: Configure Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Create branch, commit and push
run: |
VERSION=$(grep -oP '(?<=version = ")[^"]*' Cargo.toml | head -1)
BRANCH_NAME="release/v$VERSION"
git switch -c $BRANCH_NAME
git add .
git commit -m ":bookmark: v$VERSION"
git push --set-upstream origin $BRANCH_NAME