Skip to content

Commit

Permalink
Update maven.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
akl7777777 authored Aug 16, 2024
1 parent 64b15b7 commit 01ef63f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
release:
types: [created]

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -17,20 +20,21 @@ jobs:
java-version: '11'
distribution: 'temurin'

- name: Set version in pom.xml
run: |
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v} # Remove 'v' prefix if present
mvn versions:set -DnewVersion=$VERSION
- name: Build with Maven
run: mvn clean package

- name: Get artifact path
id: get_artifact
run: |
echo "ARTIFACT_PATH=$(ls target/ShellApiLogOptimizer-*.jar | head -n 1)" >> $GITHUB_OUTPUT
- name: Upload JAR
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.get_artifact.outputs.ARTIFACT_PATH }}
asset_path: ./target/ShellApiLogOptimizer-${{ github.ref_name }}.jar
asset_name: ShellApiLogOptimizer-${{ github.ref_name }}.jar
asset_content_type: application/java-archive

0 comments on commit 01ef63f

Please sign in to comment.