-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (71 loc) · 2.07 KB
/
bump_version.yml
File metadata and controls
78 lines (71 loc) · 2.07 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
76
77
name: Bump version
on:
workflow_call:
inputs:
git_name:
description: The commit author name
required: true
type: string
git_email:
description: The email address to commit with
required: true
type: string
secrets:
CUSTOM_GITHUB_TOKEN:
required: true
jobs:
check_present:
runs-on: ubuntu-latest
outputs:
bump: ${{ steps.check.outputs.bump }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Check Present
id: check
run: |
set +e
grep "new_version[[:space:]]*=" .bumpversion.cfg
x=$?
echo $x
if [ $x -eq 0 ]; then echo "bump=present" >> $GITHUB_OUTPUT; else echo "bump=missing" >> $GITHUB_OUTPUT; fi
- name: Print output
run: |
echo ${{ steps.check.outputs.bump }}
bump_version:
runs-on: ubuntu-latest
needs: check_present
if: needs.check_present.outputs.bump == 'present'
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
persist-credentials: false
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Install bump2version
run: |
pip install --no-cache-dir bump2version
- name: Configure git user
run: |
git config --global user.name ${{ inputs.git_name }}
git config --global user.email ${{ inputs.git_email }}
git config --global pull.rebase false
- name: Check auto correctly configured
run: |
grep --fixed-strings '[bumpversion:part:auto]' .bumpversion.cfg
- name: Bump version
run: |
bump2version auto
- name: Push changes
uses: ad-m/github-push-action@35284cf030a5836cb567a7bf1b39ebafbfae5f4a
with:
github_token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true