Skip to content

Commit 350534d

Browse files
release action
1 parent 4f2acf6 commit 350534d

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

.github/workflows/release.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,37 @@ jobs:
1111

1212
steps:
1313
- name: Checkout code
14-
uses: actions/checkout@v2
14+
uses: actions/checkout@v4
1515

1616
- name: Set up JDK 11
17-
uses: actions/setup-java@v2
17+
uses: actions/setup-java@v4
1818
with:
1919
java-version: '11'
20-
distribution: 'adopt'
21-
22-
- name: Cache Maven dependencies
23-
uses: actions/cache@v4
24-
with:
25-
path: ~/.m2/repository
26-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
27-
restore-keys: |
28-
${{ runner.os }}-maven-
20+
distribution: 'temurin'
21+
cache: 'maven'
22+
server-id: central
23+
server-username: MAVEN_USERNAME
24+
server-password: MAVEN_PASSWORD
25+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
26+
gpg-passphrase: GPG_PASSPHRASE
2927

3028
# Set version from tag
3129
- name: Set version from tag
3230
run: |
3331
TAG_VERSION=${GITHUB_REF#refs/tags/v}
3432
mvn versions:set -DnewVersion=${TAG_VERSION} -DgenerateBackupPoms=false
3533
36-
# Run Maven to package the project
37-
- name: Build with Maven
38-
run: mvn clean package -DskipTests
34+
# Run tests
35+
- name: Run tests
36+
run: mvn test
37+
38+
# Build and deploy to Maven Central
39+
- name: Build and deploy to Maven Central
40+
run: mvn -B clean deploy -DskipTests -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
41+
env:
42+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
43+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
44+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
3945

4046
# Upload the JAR as a release asset
4147
- name: Upload JAR to GitHub Releases

0 commit comments

Comments
 (0)