-
Notifications
You must be signed in to change notification settings - Fork 13
67 lines (60 loc) · 2.01 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Updates version and tags
on:
push:
branches: ["devel"]
permissions:
contents: write
jobs:
update_version_and_tag:
runs-on: ubuntu-latest
if:
"!startsWith(github.event.head_commit.message, '[SKIP]') &&
!startsWith(github.event.head_commit.message, 'Version updated')"
environment:
name: CD
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
- name: Install Python 3
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Setup env variables
run: |
echo "SKIPBUMP=FALSE" >> $GITHUB_ENV
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bump-my-version==0.16.2 setuptools wheel twine
- name: Configure git
run: |
git config --global user.name 'PartCAD GitHub Action'
git config --global user.email '[email protected]'
# If a commit starts with [MAJOR] a new major verion upgrade will be
# triggered. Use with caution as Major upgrades denote backwards
# incompatibility. Yet I like it to be integrated in the CI
- name: Bump Major Version
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
run: |
bump-my-version bump major
echo "SKIPBUMP=TRUE" >> $GITHUB_ENV
if: startsWith(github.event.head_commit.message, '[MAJOR]')
- name: Bump Minor Version
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
run: |
bump-my-version bump minor
echo "SKIPBUMP=TRUE" >> $GITHUB_ENV
if: startsWith(github.event.head_commit.message, '[FEATURE]')
# Default action
- name: Bump Patch Version
env:
COMMIT_MSG: ${{ github.event.head_commit.message }}
run: |
bump-my-version bump patch
if: env.SKIPBUMP == 'FALSE'
- name: Commit version change to repo
run: |
git push --force --follow-tags