-
Notifications
You must be signed in to change notification settings - Fork 1
48 lines (41 loc) · 1.69 KB
/
update-version-level.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
name: Check and update project version level
on:
push:
branches:
- master
jobs:
check-version-level-and-update:
if: github.repository == 'oncokb/oncokb-sop'
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_MAJOR='NEXT_MAJOR_VERSION'
RELEASE_DRAFTER_MINOR='NEXT_MINOR_VERSION'
RELEASE_DRAFTER_PATCH='NEXT_PATCH_VERSION'
if [[ $VERSION_LEVEL == 'major' ]]; then
sed -i "s/$RELEASE_DRAFTER_PATCH/$RELEASE_DRAFTER_MAJOR/gi" .github/release-drafter.yml
sed -i "s/$RELEASE_DRAFTER_MINOR/$RELEASE_DRAFTER_MAJOR/gi" .github/release-drafter.yml
fi
if [[ $VERSION_LEVEL == 'minor' ]]; then
sed -i "s/$RELEASE_DRAFTER_MAJOR/$RELEASE_DRAFTER_MINOR/gi" .github/release-drafter.yml
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_MAJOR/$RELEASE_DRAFTER_PATCH/gi" .github/release-drafter.yml
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 [email protected]
git add .
git commit -m "Update action files to align the version level to $VERSION_LEVEL"
git push -f
fi