File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 9
9
inputs :
10
10
version :
11
11
description : New version number (e.g. '1.2.3' without the 'v' prefix)
12
- required : true
13
12
14
13
jobs :
15
14
prepare_release :
@@ -37,19 +36,32 @@ jobs:
37
36
with :
38
37
node-version : 14
39
38
39
+ - name : Calculate version
40
+ id : get_version
41
+ run : |
42
+ if [ "${VERSION}" = "" ] ; then
43
+ LATEST_TAG=$(git describe --tags --abbrev=0)
44
+ NEXT_TAG=$(echo ${LATEST_TAG#v} | awk '{split($0, a, "."); print a[1] "." a[2] + 1 "." a[3]}')
45
+ echo ::set-output name=version::$NEXT_TAG
46
+ else
47
+ echo ::set-output name=version::$VERSION
48
+ fi
49
+ env :
50
+ VERSION : ${{ github.event.inputs.version }}
51
+
40
52
- name : Bump version
41
53
run : |
42
54
git switch -c "release/${RELEASE_VERSION}"
43
55
npm version --allow-same-version --no-git-tag-version "${RELEASE_VERSION}"
44
56
git commit --allow-empty -a -m "Bump version to ${RELEASE_VERSION}"
45
57
git push -f --set-upstream origin "release/${RELEASE_VERSION}"
46
58
env :
47
- RELEASE_VERSION : ${{ github.event.inputs .version }}
59
+ RELEASE_VERSION : ${{ steps.get_version.outputs .version }}
48
60
49
61
- name : Create PR
50
62
uses : actions/github-script@v5
51
63
env :
52
- RELEASE_VERSION : ${{ github.event.inputs .version }}
64
+ RELEASE_VERSION : ${{ steps.get_version.outputs .version }}
53
65
BASE : ${{ github.event.ref }}
54
66
with :
55
67
github-token : ${{ steps.get_token.outputs.token }}
You can’t perform that action at this time.
0 commit comments