-
Notifications
You must be signed in to change notification settings - Fork 9
50 lines (50 loc) · 1.52 KB
/
version_bump.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
49
50
name: bump version
on:
push:
branches:
- main
jobs:
bump_version:
if: |
github.repository_owner == 'maidsafe' &&
!startsWith(github.event.head_commit.message, 'chore(release):')
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: "0"
token: ${{ secrets.RELEASE_PAT }}
- uses: actions-rs/toolchain@v1
id: toolchain
with:
profile: minimal
toolchain: stable
override: true
- name: configure git for release
shell: bash
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- uses: cargo-bins/cargo-binstall@main
- shell: bash
run: cargo binstall --no-confirm release-plz
- name: bump version
shell: bash
run: |
set -e
release-plz update
if [[ -z $(git status --porcelain) ]]; then
echo "No changes were detected. Exiting without bumping the version."
exit 0
fi
version=$(cat Cargo.toml | grep "^version" | awk -F '=' '{ print $2 }' | xargs)
commit_message="chore(release): $version"
git add --all
git commit -m "$commit_message"
echo "Generated release commit $commit_message"
- name: push version bump commit
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.RELEASE_PAT }}
branch: main
tags: true