Skip to content

Commit 039c7d4

Browse files
committed
Fix for workflow (2)
1 parent 88a40af commit 039c7d4

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,18 @@ jobs:
2222
- name: Set execute permissions for Gradle wrapper
2323
run: chmod +x ./gradlew
2424

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+
2532
- name: Build with Gradle
2633
run: ./gradlew build
2734

2835
- 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
3537

3638
- name: Create Release
3739
id: create_release

release.sh

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
# workflow when a new tag is pushed, which will create a release on GitHub
66
# using the tag.
77

8+
# Usage: ./release <version-number> ["Optional tag commit message"]
89

910
# Check for the correct number of input parameters
10-
if [ "$#" -ne 1 ]; then
11+
if [ "$#" -lt 1 ]; then
1112
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\""
1415
exit 1
1516
fi
1617

@@ -38,10 +39,15 @@ if git rev-parse "$TAG" >/dev/null 2>&1; then
3839
fi
3940

4041
# 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
4349

4450
# Push the tag to the remote repository
4551
git push origin "$TAG"
4652

47-
echo "Tag $TAG created and pushed successfully."
53+
echo "Tag $TAG created and pushed successfully."

0 commit comments

Comments
 (0)