1
1
name : Bump build version
2
2
description : Bumps SemVer buildVersion in the input builder-config file
3
3
inputs :
4
- build-config-file :
5
- description : File path to the builder config yaml file
4
+ platform :
5
+ description : Platform to update builder config yaml file
6
+ required : true
7
+ token :
8
+ description : GitHub token
6
9
required : true
7
10
commit :
8
11
description : If true, will add and commit the new build version. Default false.
@@ -15,11 +18,17 @@ outputs:
15
18
runs :
16
19
using : " composite"
17
20
steps :
21
+ - name : Get build config file
22
+ id : filepath
23
+ run : |
24
+ echo "build-config-file=web/build/builder-${{ inputs.platform }}-config.yaml" >> $GITHUB_OUTPUT
25
+ shell : bash
26
+
18
27
- name : Get current build version
19
28
id : current-build-version
20
29
run : |
21
- version="$(yq '.buildVersion' ${{ inputs .build-config-file }})"
22
- echo "Current buildVersion in ${{ inputs .build-config-file }} is $version"
30
+ version="$(yq '.buildVersion' ${{ steps.filepath.outputs .build-config-file }})"
31
+ echo "Current buildVersion in ${{ steps.filepath.outputs .build-config-file }} is $version"
23
32
echo "version=$version" >> $GITHUB_OUTPUT
24
33
shell : bash
25
34
@@ -30,15 +39,35 @@ runs:
30
39
current_version : ${{ steps.current-build-version.outputs.version }}
31
40
level : patch
32
41
33
- - name : Update ${{ inputs .build-config-file }} buildVersion
42
+ - name : Update ${{ steps.filepath.outputs .build-config-file }} buildVersion
34
43
run : |
35
- yq -i '.buildVersion = "${{ steps.bump-version.outputs.new_version }}"' ${{ inputs.build-config-file }}
36
- echo "New buildVersion in ${{ inputs.build-config-file }} is ${{ steps.bump-version.outputs.new_version }}"
44
+ yq -i '.buildVersion = "${{ steps.bump-version.outputs.new_version }}"' ${{ steps.filepath.outputs.build-config-file }}
45
+ echo "New buildVersion in ${{ steps.filepath.outputs.build-config-file }} is ${{ steps.bump-version.outputs.new_version }}"
46
+ shell : bash
47
+
48
+ - name : Get current branch
49
+ id : current-branch
50
+ run : |
51
+ echo "branch=$(git branch --show-current)" >> $GITHUB_OUTPUT
37
52
shell : bash
38
53
39
54
- name : Add and commit new build version
40
55
if : ${{ inputs.commit == 'true' }}
41
56
uses : EndBug/add-and-commit@v9
42
57
with :
43
- message : " Update ${{ inputs.build-config-file }} buildVersion to ${{ steps.bump-version.outputs.new_version }}"
44
- pull : origin
58
+ message : " Update ${{ steps.filepath.outputs.build-config-file }} buildVersion to ${{ steps.bump-version.outputs.new_version }} [skip ci]"
59
+ pull : ${{ steps.current-branch.outputs.branch != format('build/{0}', inputs.platform) && format('origin {0}', steps.current-branch.outputs.branch) || '' }}
60
+ push : --set-upstream origin ${{ steps.current-branch.outputs.branch }}
61
+
62
+ - name : Raise PR and merge
63
+ if : ${{ inputs.commit == 'true' }}
64
+ run : |
65
+ CURRENT_BRANCH=${{ steps.current-branch.outputs.branch }}
66
+ if [[ $CURRENT_BRANCH == build/* ]]
67
+ then
68
+ gh pr create --base main --head $CURRENT_BRANCH --title "Update ${{ inputs.platform }} build version to ${{ steps.bump-version.outputs.new_version }}" --body "Increment version"
69
+ gh pr merge --merge --delete-branch $CURRENT_BRANCH
70
+ fi
71
+ env :
72
+ GITHUB_TOKEN : ${{ inputs.token }}
73
+ shell : bash
0 commit comments