forked from oncokb/oncokb
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (76 loc) · 2.67 KB
/
after-master-commit.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: After master commit
on:
push:
branches:
- master
jobs:
check-version-level-and-update:
if: github.repository == 'oncokb/oncokb'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Update Version Level'
run: |
git pull
VERSION_LEVEL=$(cat .version-level | tr "[:upper:]" "[:lower:]")
RELEASE_DRAFTER_MINOR='NEXT_MINOR_VERSION'
RELEASE_DRAFTER_PATCH='NEXT_PATCH_VERSION'
if [[ $VERSION_LEVEL == 'minor' ]]; then
sed -i "s/$RELEASE_DRAFTER_PATCH/$RELEASE_DRAFTER_MINOR/gi" .github/release-drafter.yml
fi
if [[ $VERSION_LEVEL == 'patch' ]]; then
sed -i "s/$RELEASE_DRAFTER_MINOR/$RELEASE_DRAFTER_PATCH/gi" .github/release-drafter.yml
fi
CHANGED=$(git diff --name-only HEAD --)
if [ -n "$CHANGED" ]
then
git config user.name oncokb-bot
git config user.email dev.oncokb@gmail.com
git add .
git commit -m "Update action files to align the version level to $VERSION_LEVEL"
git push -f
fi
update-pom:
if: github.repository == 'oncokb/oncokb'
needs: [check-version-level-and-update]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Get Previous tag'
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@master"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: 'Get next semantic versions'
id: semvers
uses: "WyriHaximus/github-action-next-semvers@v1"
with:
version: ${{ steps.previoustag.outputs.tag }}
- name: 'Setup Java'
uses: actions/setup-java@v1
with:
java-version: 8
- name: 'Get Current Version Level'
id: 'version-level'
run: |
VERSION_LEVEL=$(cat .version-level | tr "[:upper:]" "[:lower:]")
echo "::set-output name=VERSION_LEVEL::$VERSION_LEVEL"
- name: 'Update Pom'
env:
NEW_VERSION: ${{ steps.version-level.outputs.VERSION_LEVEL == 'minor' && steps.semvers.outputs.minor || steps.semvers.outputs.patch}}
run: |
git pull
mvn --batch-mode versions:set -DnewVersion=${NEW_VERSION} -DgenerateBackupPoms=false
CHANGED=$(git diff --name-only HEAD --)
if [ -n "$CHANGED" ]
then
git config user.name oncokb-bot
git config user.email dev.oncokb@gmail.com
git add .
git commit -m 'Update pom version'
git push -f
fi