File tree Expand file tree Collapse file tree 2 files changed +20
-12
lines changed Expand file tree Collapse file tree 2 files changed +20
-12
lines changed Original file line number Diff line number Diff line change @@ -22,16 +22,18 @@ jobs:
22
22
- name : Set execute permissions for Gradle wrapper
23
23
run : chmod +x ./gradlew
24
24
25
+ - name : Set TAG_NAME and JAR_NAME environment variable
26
+ run : |
27
+ echo "TAG_NAME=${GITHUB_REF#refs/tags/release_}" >> $GITHUB_ENV
28
+ echo "JAR_NAME=c3pu-$TAG_NAME.jar" >> $GITHUB_ENV
29
+ env :
30
+ GITHUB_REF : ${{ github.ref }}
31
+
25
32
- name : Build with Gradle
26
33
run : ./gradlew build
27
34
28
35
- name : Rename JAR File
29
- run : |
30
- TAG_NAME=${GITHUB_REF#refs/tags/release_}
31
- JAR_NAME=c3pu-$TAG_NAME.jar
32
- mv build/libs/c3pu-*.jar build/libs/$JAR_NAME
33
- env :
34
- GITHUB_REF : ${{ github.ref }}
36
+ run : mv build/libs/c3pu-*.jar build/libs/$JAR_NAME
35
37
36
38
- name : Create Release
37
39
id : create_release
Original file line number Diff line number Diff line change 5
5
# workflow when a new tag is pushed, which will create a release on GitHub
6
6
# using the tag.
7
7
8
+ # Usage: ./release <version-number> ["Optional tag commit message"]
8
9
9
10
# Check for the correct number of input parameters
10
- if [ " $# " -ne 1 ]; then
11
+ if [ " $# " -lt 1 ]; then
11
12
echo " Error: Incorrect number of arguments."
12
- echo " Usage: $0 <version-number>"
13
- echo " Example: $0 v1.0.1"
13
+ echo " Usage: $0 <version-number> [ \" tag commit message \" ] "
14
+ echo " Example: $0 v1.0.1 \" Initial release \" "
14
15
exit 1
15
16
fi
16
17
@@ -38,10 +39,15 @@ if git rev-parse "$TAG" >/dev/null 2>&1; then
38
39
fi
39
40
40
41
# Create the annotated tag
41
- # git tag -a "$TAG" -m "$MESSAGE"
42
- git tag -a " $TAG "
42
+ if [ -z " $2 " ]; then
43
+ # If no message is provided, open the editor to allow the user to enter a message
44
+ git tag -a " $TAG "
45
+ else
46
+ # If a message is provided, use it directly
47
+ git tag -a " $TAG " -m " $2 "
48
+ fi
43
49
44
50
# Push the tag to the remote repository
45
51
git push origin " $TAG "
46
52
47
- echo " Tag $TAG created and pushed successfully."
53
+ echo " Tag $TAG created and pushed successfully."
You can’t perform that action at this time.
0 commit comments