-
Notifications
You must be signed in to change notification settings - Fork 132
53 lines (45 loc) · 1.81 KB
/
bump-version.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
51
52
53
name: Bump version # only when test
on:
workflow_call:
secrets:
CI_TOKEN_TO_TRIGGER_PUSH_WORKFLOW:
description: "A token passed from the caller workflow so git push can trigger workflow"
required: true
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
token: ${{ secrets.CI_TOKEN_TO_TRIGGER_PUSH_WORKFLOW }}
- name: Get next version
id: next_version
uses: thenativeweb/get-next-version@main
- name: Show the next version
run: |
echo ${{ steps.next_version.outputs.version }}
echo ${{ steps.next_version.outputs.hasNextVersion }}
- name: Bump version file
if: steps.next_version.outputs.hasNextVersion == 'true'
run: |
perl -i -p -e \
"s/(pure_version)\s(\d+(\.)?){3}/\1 ${{ steps.next_version.outputs.version }}/" \
./conf.d/pure.fish
- name: Set git user metadata
if: steps.next_version.outputs.hasNextVersion == 'true'
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Commit new version file
if: steps.next_version.outputs.hasNextVersion == 'true'
run: |
git add --verbose ./conf.d/pure.fish \
&& git commit --allow-empty --message "chore: bump version ${{ steps.next_version.outputs.version }}"
- name: Push bump commit
if: steps.next_version.outputs.hasNextVersion == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.CI_TOKEN_TO_TRIGGER_PUSH_WORKFLOW }}