@@ -2,14 +2,20 @@ name: prerelease
2
2
3
3
on :
4
4
# Run Every Wednesday at 01:00 AM UTC
5
- schedule :
6
- - cron : ' 0 2 * * 3'
5
+ # schedule:
6
+ # - cron: '0 2 * * 3'
7
7
workflow_dispatch :
8
8
inputs :
9
- release-as-minor :
10
- description : " Minor Release (default: Patch)"
11
- type : boolean
12
- default : false
9
+ release-tag :
10
+ description : " Release tag (default: Patch)"
11
+ required : true
12
+ type : choice
13
+ default : ' patch'
14
+ options :
15
+ - patch
16
+ - minor
17
+ - major
18
+
13
19
skip-release :
14
20
description : " Skip the tag creation step (default: false)"
15
21
type : boolean
@@ -63,19 +69,22 @@ jobs:
63
69
- name : Prepare Release
64
70
if : steps.changes.outputs.HAS_CHANGES == 'true'
65
71
env :
66
- IS_MINOR : ${{ contains( inputs.release-as-minor, 'true') }}
72
+ RELEASE_TAG : ${{ inputs.release-tag }}
67
73
GITHUB_TOKEN : ${{ secrets.RELEASE_TOKEN }}
68
74
run : |
69
75
CURRENT_VERSION_PARTS=(${CURRENT_VERSION//./ })
70
76
MAJOR=${CURRENT_VERSION_PARTS[0]}
71
77
MINOR=${CURRENT_VERSION_PARTS[1]}
72
78
PATCH=${CURRENT_VERSION_PARTS[2]}
73
79
74
- if [[ $IS_MINOR == "true" ]]
75
- then
80
+ if [[ $RELEASE_TAG == "major" ]]; then
81
+ MAJOR=$((MAJOR+1))
82
+ MINOR=0
83
+ PATCH=0
84
+ elif [[ $RELEASE_TAG == "minor" ]]; then
76
85
MINOR=$((MINOR+1))
77
86
PATCH=0
78
- else
87
+ elif [[ $RELEASE_TAG == "patch" ]]; then
79
88
PATCH=$((PATCH+1))
80
89
fi
81
90
86
95
echo "New Version will be: $NEW_VERSION"
87
96
echo "## Updating ${CURRENT_VERSION} to ${NEW_VERSION}" >> $GITHUB_STEP_SUMMARY
88
97
98
+ echo "## Commits that will be added to the release" >> $GITHUB_STEP_SUMMARY
99
+ echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
100
+ git log --oneline $CURRENT_VERSION...master | cat >> $GITHUB_STEP_SUMMARY
101
+ echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
102
+
103
+
89
104
- name : Release New Version
90
105
if : ${{ success() && github.ref_name == 'master' && steps.changes.outputs.HAS_CHANGES == 'true' && !inputs.skip-release }}
91
106
env :
107
+ # Github actions need special tokens to be able to trigger other workflows
92
108
GITHUB_TOKEN : ${{ secrets.RELEASE_TOKEN }}
93
109
run : |
94
110
git tag -a ${NEW_VERSION} -m "New version ${NEW_VERSION}"
0 commit comments