|
1 | | -# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time |
2 | | -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven |
3 | 1 |
|
4 | | -# This workflow uses actions that are not certified by GitHub. |
5 | | -# They are provided by a third-party and are governed by |
6 | | -# separate terms of service, privacy policy, and support |
7 | | -# documentation. |
8 | | - |
9 | | -name: Java Artifact |
| 2 | +name: Create Plugin.jar |
10 | 3 |
|
11 | 4 | on: |
12 | 5 | push: |
13 | 6 | branches: [ "main" ] |
14 | 7 |
|
15 | 8 | jobs: |
16 | 9 | build: |
17 | | - |
| 10 | + name: Create plugin.jar |
| 11 | + if: ${{ !startsWith(github.event.head_commit.message, '[ci-skip]') }} |
18 | 12 | runs-on: ubuntu-latest |
19 | | - |
20 | 13 | steps: |
21 | | - - uses: actions/checkout@v3 |
22 | | - - name: Set up JDK 21 |
23 | | - uses: actions/setup-java@v3 |
24 | | - with: |
25 | | - java-version: '21' |
26 | | - distribution: 'adopt' |
27 | | - cache: maven |
28 | | - - name: Build with Maven |
29 | | - run: | |
30 | | - mvn clean package |
31 | | - git_hash=$(git rev-parse --short "$GITHUB_SHA") |
32 | | - echo "git_hash=$git_hash" >> $GITHUB_ENV |
33 | | - echo "snapshotVersion=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV |
34 | | - echo "artifactPath=$(pwd)/target" >> $GITHUB_ENV |
35 | | - |
36 | | - - uses: actions/upload-artifact@v3 |
37 | | - with: |
38 | | - name: qGPTrust-v${{ env.snapshotVersion }}-${{ env.git_hash }}.jar |
39 | | - path: ${{ env.artifactPath }}/qGPTrust-${{ env.snapshotVersion }}.jar |
| 14 | + - name: Fetch Project |
| 15 | + uses: actions/checkout@v4 |
| 16 | + - name: Setup Java 21 |
| 17 | + uses: actions/setup-java@v4 |
| 18 | + with: |
| 19 | + java-version: '21' |
| 20 | + distribution: 'zulu' |
| 21 | + cache: maven |
| 22 | + - name: Build and Package Plugin |
| 23 | + run: | |
| 24 | + artifactPath="$(pwd)/target" |
| 25 | + artifactName="$(mvn help:evaluate -Dexpression=project.build.finalName -q -DforceStdout)" |
| 26 | + git_hash=$(git rev-parse --short "$GITHUB_SHA") |
| 27 | + echo "artifactPath=${artifactPath}" >> $GITHUB_ENV |
| 28 | + echo "artifactName=${artifactName}" >> $GITHUB_ENV |
| 29 | + echo git_hash=${git_hash} >> $GITHUB_ENV |
| 30 | + mvn clean package |
| 31 | + mv "${artifactPath}/${artifactName}.jar" "${artifactPath}/${artifactName}-${git_hash}.jar" |
| 32 | + - name: Upload Artifact |
| 33 | + uses: actions/upload-artifact@v4 |
| 34 | + with: |
| 35 | + name: ${{ env.artifactName }}-${{ env.git_hash }}.jar |
| 36 | + path: ${{ env.artifactPath }}/${{ env.artifactName }}-${{ env.git_hash }}.jar |
0 commit comments