-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (42 loc) · 1.25 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
name: Bump-Version
on:
push:
branches:
- main
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bump2version
- name: Configure Git Identity
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Determine version bump
id: determine_bump
run: |
COMMIT_MSG=$(git log -1 --pretty=%B)
echo "Commit message: $COMMIT_MSG"
if [[ "$COMMIT_MSG" == *"#major"* ]]; then
echo "bump_type=major" >> $GITHUB_ENV
elif [[ "$COMMIT_MSG" == *"#minor"* ]]; then
echo "bump_type=minor" >> $GITHUB_ENV
else
echo "bump_type=patch" >> $GITHUB_ENV
fi
- name: Bump the version
run: |
bump2version ${{ env.bump_type }}
- name: Push changes
run: git push origin main --tags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}