-
Notifications
You must be signed in to change notification settings - Fork 43
58 lines (51 loc) · 2 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
name: Version Bump
on:
workflow_dispatch:
inputs:
version_type:
description: 'Specify the type of version bump'
required: true
type: choice
options:
- major
- minor
- patch
default: 'patch'
jobs:
version-bump:
runs-on: ubuntu-24.04
steps:
- name: Set java home to java 17
run: |
echo "JAVA_HOME=$(echo $JAVA_HOME_17_X64)" >> $GITHUB_ENV
- uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
token: ${{ steps.generate-token.outputs.token }}
- name: Determine new version
run: |
version=$(./gradlew properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}')
IFS='.' read -r -a array <<< "$version"
echo "Previous version: $version"
case "${{ github.event.inputs.version_type }}" in
"major") new_version="$((array[0]+1)).0.0" ;;
"minor") new_version="${array[0]}.$((array[1]+1)).0" ;;
"patch") new_version="${array[0]}.${array[1]}.$((array[2]+1))" ;;
*) echo "Invalid version type" && exit 1 ;;
esac
echo "new_version=$new_version" >> $GITHUB_ENV
- name: Update version
run: sed -i "s/version = \".*\"/version = \"${{ env.new_version }}\"/" build.gradle.kts
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a
with:
commit_message: "Version bump"
file_pattern: "build.gradle.kts"
commit_user_name: ThetaBotMaintainer[bot]
commit_user_email: 139346997+ThetaBotMaintainer[bot]@users.noreply.github.com
commit_author: ThetaBotMaintainer[bot] <139346997+ThetaBotMaintainer[bot]@users.noreply.github.com>