Skip to content

Commit 3207ceb

Browse files
committed
update ci to use new actions
1 parent 4721e46 commit 3207ceb

File tree

1 file changed

+26
-29
lines changed

1 file changed

+26
-29
lines changed

.github/workflows/maven.yml

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,36 @@
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
31

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
103

114
on:
125
push:
136
branches: [ "main" ]
147

158
jobs:
169
build:
17-
10+
name: Create plugin.jar
11+
if: ${{ !startsWith(github.event.head_commit.message, '[ci-skip]') }}
1812
runs-on: ubuntu-latest
19-
2013
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

Comments
 (0)