@@ -5,7 +5,7 @@ permissions:
55
66on :
77 push :
8- branches : [ main ]
8+ tags : [ 'v*' ]
99
1010jobs :
1111 test :
9090 release :
9191 runs-on : ubuntu-latest
9292 needs : [test, jitpack-compatibility]
93+ if : startsWith(github.ref, 'refs/tags/v')
9394
9495 steps :
9596 - name : Check deploy token
99100 exit 1
100101 fi
101102 echo "DEPLOY_TOKEN is available. Proceeding with release."
102-
103103 - name : Checkout repository
104104 uses : actions/checkout@v4
105105 with :
@@ -124,32 +124,24 @@ jobs:
124124 - name : Make gradlew executable
125125 run : chmod +x ./gradlew
126126
127- - name : Final build for release
128- run : ./gradlew build
129-
130- - name : Generate version tag
127+ - name : Extract version from tag
131128 id : version
132129 run : |
133- VERSION="v0.1.0-$(date +%Y%m%d-%H%M%S)"
134- echo "tag=$VERSION" >> $GITHUB_OUTPUT
135- echo "Generated tag: $VERSION"
130+ TAG=${GITHUB_REF#refs/tags/}
131+ VERSION=${TAG#v}
132+ echo "tag=$TAG" >> $GITHUB_OUTPUT
133+ echo "version=$VERSION" >> $GITHUB_OUTPUT
136134
137- - name : Create and push tag
138- run : |
139- TAG="${{ steps.version.outputs.tag }}"
140- echo "Creating release tag: $TAG"
141- git config user.name "github-actions[bot]"
142- git config user.email "github-actions[bot]@users.noreply.github.com"
143- git tag "$TAG"
144- git push origin "$TAG"
135+ - name : Final build for release
136+ run : ./gradlew build
145137
146138 - name : Create GitHub Release
147139 uses : softprops/action-gh-release@v1
148140 with :
149141 tag_name : ${{ steps.version.outputs.tag }}
150142 name : " Release ${{ steps.version.outputs.tag }}"
151143 body : |
152- 🚀 자동 생성 릴리스: ${{ steps.version.outputs.tag }}
144+ 🚀 릴리스: ${{ steps.version.outputs.tag }}
153145
154146 ## JitPack 사용법
155147
@@ -160,7 +152,7 @@ jobs:
160152 }
161153
162154 dependencies {
163- implementation 'com.github.hj4645:commit-chronicle:${{ steps.version.outputs.tag }}'
155+ implementation 'com.github.hj4645:commit-chronicle:${{ steps.version.outputs.version }}'
164156 }
165157 ```
166158
@@ -177,15 +169,15 @@ jobs:
177169 <dependency>
178170 <groupId>com.github.hj4645</groupId>
179171 <artifactId>commit-chronicle</artifactId>
180- <version>${{ steps.version.outputs.tag }}</version>
172+ <version>${{ steps.version.outputs.version }}</version>
181173 </dependency>
182174 </dependencies>
183175 ```
184176
185177 ## CLI 사용법
186178 ```bash
187179 # alias 설정
188- alias cch="java -jar ~/.gradle/caches/modules-2/files-2.1/com.github.hj4645/commit-chronicle/${{ steps.version.outputs.tag }}/*/commitchronicle-0.1.0 .jar"
180+ alias cch="java -jar ~/.gradle/caches/modules-2/files-2.1/com.github.hj4645/commit-chronicle/${{ steps.version.outputs.version }}/*/commitchronicle-${{ steps.version.outputs.version }} .jar"
189181
190182 # 사용
191183 cch summarize
0 commit comments