Skip to content

Commit 25fcc2a

Browse files
committed
package version with git tag
1 parent 15771d9 commit 25fcc2a

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

.github/workflows/01_master.yml

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
3+
4+
name: Maven Package
5+
6+
on:
7+
push:
8+
branches: [main]
9+
10+
jobs:
11+
ci-pipeline:
12+
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up JDK 11
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '11'
24+
distribution: 'temurin'
25+
26+
- name: Test with Maven
27+
run: mvn test

.github/workflows/02_maven-package.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
name: Maven Package
55

66
on:
7-
push:
8-
branches: [main]
7+
release:
8+
types: [published]
9+
workflow_dispatch: # enable manual workflow run
910

1011
jobs:
1112
build-and-release:
@@ -25,11 +26,11 @@ jobs:
2526
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
2627
settings-path: ${{ github.workspace }} # location for the settings.xml file
2728

28-
- name: Test with Maven
29-
run: mvn test
29+
- name: Update version in pom.xml (Release only)
30+
run: mvn -B versions:set -DnewVersion=${{ github.event.release.tag_name }} -DgenerateBackupPoms=false
3031

3132
- name: Build with Maven
32-
run: mvn -B package --file pom.xml
33+
run: mvn -B package --file pom.xml -Dmaven.test.skip=true
3334

3435
- name: Publish to GitHub Packages Apache Maven
3536
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml

0 commit comments

Comments
 (0)