-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
action.yml
57 lines (56 loc) · 1.92 KB
/
action.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
54
55
56
57
name: Bump My Version
description: Bump version of a project
inputs:
args:
description: 'May contain any of the following: VERSION_PART (e.g. minor), FILES (additional file(s) to modify).'
required: false
default: ''
github-token:
description: 'GitHub Token to use instead of the default one.'
required: false
default: ${{ github.token }}
outputs:
bumped:
description: 'Whether there was a bump or not [true|false]'
value: ${{ steps.bump.outputs.bumped }}
previous-version:
description: 'Previous version'
value: ${{ steps.bump.outputs.previous-version }}
current-version:
description: 'Updated version'
value: ${{ steps.bump.outputs.current-version }}
runs:
using: 'composite'
steps:
- name: Checkout the code
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setting up git config
shell: bash
env:
GH_TOKEN: ${{ inputs.github-token }}
run: |
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.name "$(gh api /users/${GITHUB_ACTOR} | jq .name -r)"
git config -l
- name: Install Python
uses: actions/setup-python@v5.1.1
with:
python-version: '3.12'
- name: Install bump-my-version
shell: bash
run: pip install "bump-my-version==0.28.1"
- name: Pass Inputs to Shell
id: bump
shell: bash
run: |
echo "previous-version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
bump-my-version bump ${{ inputs.args }}
([[ $? -gt 0 ]] && echo "bumped=false" || echo "bumped=true") >> $GITHUB_OUTPUT
echo "current-version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
- name: Push changes to GitHub
uses: ad-m/github-push-action@master
with:
github_token: ${{ inputs.github-token }}
force: true