Skip to content

Commit 01ef63f

Browse files
authored
Update maven.yml
1 parent 64b15b7 commit 01ef63f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/maven.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
release:
55
types: [created]
66

7+
permissions:
8+
contents: write
9+
710
jobs:
811
build:
912
runs-on: ubuntu-latest
@@ -17,20 +20,21 @@ jobs:
1720
java-version: '11'
1821
distribution: 'temurin'
1922

23+
- name: Set version in pom.xml
24+
run: |
25+
VERSION=${GITHUB_REF#refs/tags/}
26+
VERSION=${VERSION#v} # Remove 'v' prefix if present
27+
mvn versions:set -DnewVersion=$VERSION
28+
2029
- name: Build with Maven
2130
run: mvn clean package
2231

23-
- name: Get artifact path
24-
id: get_artifact
25-
run: |
26-
echo "ARTIFACT_PATH=$(ls target/ShellApiLogOptimizer-*.jar | head -n 1)" >> $GITHUB_OUTPUT
27-
2832
- name: Upload JAR
2933
uses: actions/upload-release-asset@v1
3034
env:
3135
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3236
with:
3337
upload_url: ${{ github.event.release.upload_url }}
34-
asset_path: ${{ steps.get_artifact.outputs.ARTIFACT_PATH }}
38+
asset_path: ./target/ShellApiLogOptimizer-${{ github.ref_name }}.jar
3539
asset_name: ShellApiLogOptimizer-${{ github.ref_name }}.jar
3640
asset_content_type: application/java-archive

0 commit comments

Comments
 (0)