-
Notifications
You must be signed in to change notification settings - Fork 8
61 lines (61 loc) · 2.08 KB
/
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
54
55
56
57
58
59
60
61
name: GISCE_DESTRAL_VERION
on:
push:
branches: [ master ]
jobs:
bump:
runs-on: ubuntu-latest
if: ${{ !startsWith(github.event.head_commit.message, 'Bump to v') }}
steps:
- uses: actions/checkout@v3
with:
ssh-key: ${{ secrets.SSH_PRIVATE }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Setup git
run: |
git config --global user.email "[email protected]"
git config --global user.name "giscegit"
- name: Install python packages
run: |
pip install bump2version
pip install giscemultitools
- name: Get PR info
env:
GITHUB_TOKEN: ${{ secrets.GH_GIT_TOKEN }}
WORKSPACE: ${{github.workspace}}
run: |
echo 'PR_INFO<<EOF' >> $GITHUB_ENV
gisce_github get-commits-sha-from-merge-commit --owner gisce --repository destral --sha $GITHUB_SHA >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Retrive info
run: |
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.SSH_PRIVATE }}'
pr_labels=$( echo '${{ env.PR_INFO }}' | jq -r '.pullRequest.labels' )
is_minor=false
is_major=false
is_patch=false
for label in echo $( echo $pr_labels | jq -r '.[].name' ); do
if [[ $label == 'minor' ]]; then
is_minor=true
elif [[ $label == 'major' ]]; then
is_major=true
elif [[ $label == 'patch' ]]; then
is_patch=true
fi
done
VERSION_TYPE=false
if [[ $is_major == true ]]; then
VERSION_TYPE="major"
elif [[ $is_minor == true ]]; then
VERSION_TYPE="minor"
elif [[ $is_patch == true ]]; then
VERSION_TYPE="patch"
fi
if [[ $VERSION_TYPE != false ]]; then
bump2version $VERSION_TYPE --tag --commit -m "Bump to v{new_version}" setup.py
git push origin master --tags
fi