-
Notifications
You must be signed in to change notification settings - Fork 3
75 lines (65 loc) · 2.19 KB
/
check-version-bump.yml
File metadata and controls
75 lines (65 loc) · 2.19 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
66
67
68
69
70
71
72
73
74
75
# vim: sw=2
name: Misc
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
permissions:
contents: write
pull-requests: read
jobs:
check-version-bump:
name: Check version bump
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Check version bump
id: version-check
continue-on-error: ${{startsWith(github.head_ref, 'dependabot/')}}
uses: silicon-heaven/rust-check-version-bump@v1.0.1
- name: Check if Cargo.lock was changed
continue-on-error: ${{startsWith(github.head_ref, 'dependabot/')}}
run: |
cargo update --workspace
if ! git diff --exit-code; then
echo "Error: No version bump detected in Cargo.lock"
exit 1
fi
- name: Fetch Dependabot metadata
id: dependabot-metadata
if: steps.version-check.outcome == 'failure'
uses: dependabot/fetch-metadata@v3
with:
github-token: ${{secrets.GITHUB_TOKEN}}
- name: Checkout code
if: steps.version-check.outcome == 'failure'
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{github.head_ref}}
- name: Bump version
if: steps.version-check.outcome == 'failure'
run: |
echo "Bumping version by patch"
cargo install cargo-bump
cargo bump patch
cargo update --workspace
- name: Commit changes
if: steps.version-check.outcome == 'failure'
run: |
git diff
git config --global user.name "Login will be determined by the Github API based on the creator of the token"
git config --global user.email ""
git commit -am '[dependabot-skip] Bump version'
- name: Push changes
if: steps.version-check.outcome == 'failure'
uses: Asana/push-signed-commits@v1
with:
github-token: ${{secrets.DEPENDABOT_GITHUB_TOKEN}}
local_branch_name: ${{github.head_ref}}
remote_branch_name: ${{github.head_ref}}