Skip to content

Commit abc09fc

Browse files
authored
Release with matrix build (#45)
1 parent fe887fc commit abc09fc

File tree

3 files changed

+34
-21
lines changed

3 files changed

+34
-21
lines changed

.github/workflows/netlicensing-client-release.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ jobs:
1414
name: Release ${{ github.event.inputs.release-version }}
1515
runs-on: self-hosted
1616
container: maven:3-amazoncorretto-17
17+
strategy:
18+
matrix:
19+
java-version: [11, 17]
20+
include:
21+
- java-version: 11
22+
jdk-suffix:
23+
- java-version: 17
24+
jdk-suffix: -jdk17
1725

1826
steps:
1927
- uses: actions/checkout@v3
@@ -45,12 +53,20 @@ jobs:
4553
- name: Import GPG key
4654
run: echo "${{ secrets.GPG_KEY }}" | base64 -d | gpg --pinentry-mode loopback --passphrase "${{ secrets.GPG_KEY_PASS }}" --import
4755

56+
- name: Calculate branch suffix
57+
run: |
58+
BRANCH_SUFFIX=${{ matrix.jdk-suffix }}
59+
echo "Branch suffix: '$BRANCH_SUFFIX'"
60+
echo "BRANCH_SUFFIX=$BRANCH_SUFFIX" >> "$GITHUB_ENV"
61+
4862
- name: Release to Maven Central staging
4963
run: |
5064
mvn -s ~/.m2/settings.xml -B \
5165
clean deploy scm:tag \
5266
-P release \
5367
-Drevision=${{ github.event.inputs.release-version }} \
68+
-Dsha1=$BRANCH_SUFFIX \
5469
-Dchangelist= \
70+
-Djava.version=${{ matrix.java-version }}
5571
-Dmessage="Release ${{ github.event.inputs.release-version }}" \
5672
-Dgpg.passphrase=${{ secrets.GPG_KEY_PASS }}

.github/workflows/netlicesning-client-ci.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,14 @@ jobs:
2828
java-version: [11, 17]
2929
include:
3030
- java-version: 11
31-
mvn-goal: deploy
31+
jdk-suffix:
3232
- java-version: 17
33-
mvn-goal: verify
33+
jdk-suffix: -jdk17
3434

3535

3636
steps:
3737
- uses: actions/checkout@v3
3838

39-
- name: Set up JDK ${{ matrix.java-version }}
40-
uses: actions/setup-java@v3
41-
with:
42-
java-version: ${{ matrix.java-version }}
43-
distribution: 'adopt'
44-
cache: maven
45-
4639
- name: Prepare maven settings.xml
4740
run: |
4841
mkdir -p ~/.m2
@@ -64,16 +57,20 @@ jobs:
6457
if [ "$GITHUB_REF_NAME" = "master" ]
6558
then
6659
# No suffix when running against "master" branch
67-
BRANCH_SUFFIX=
60+
BRANCH_SUFFIX=${{ matrix.jdk-suffix }}
6861
else
6962
# When running from pull request, use "-pr-<N>" suffix, where <N> is a PR number
70-
BRANCH_SUFFIX=-pr-${GITHUB_REF_NAME//\/merge/}
63+
BRANCH_SUFFIX=${{ matrix.jdk-suffix }}-pr-${GITHUB_REF_NAME//\/merge/}
7164
fi
7265
echo "Branch suffix: '$BRANCH_SUFFIX'"
7366
echo "BRANCH_SUFFIX=$BRANCH_SUFFIX" >> "$GITHUB_ENV"
7467
7568
- name: Build with Maven
76-
run: mvn -B clean ${{ matrix.mvn-goal }} -Drepo.snapshots.url=${{ secrets.SNAPSHOTS_URL }} -Dsha1=$BRANCH_SUFFIX
69+
run: |
70+
mvn -B clean deploy \
71+
-Drepo.snapshots.url=${{ secrets.SNAPSHOTS_URL }} \
72+
-Dsha1=$BRANCH_SUFFIX \
73+
-Djava.version=${{ matrix.java-version }}
7774
7875
- name: Run Demo App
7976
run: |

pom.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@
143143
</execution>
144144
</executions>
145145
</plugin>
146-
<plugin>
147-
<groupId>org.apache.maven.plugins</groupId>
148-
<artifactId>maven-site-plugin</artifactId>
149-
<version>${maven-site-plugin.version}</version>
150-
<configuration>
151-
<locales>en</locales>
152-
<outputEncoding>UTF-8</outputEncoding>
153-
</configuration>
154-
</plugin>
146+
<plugin>
147+
<groupId>org.apache.maven.plugins</groupId>
148+
<artifactId>maven-site-plugin</artifactId>
149+
<version>${maven-site-plugin.version}</version>
150+
<configuration>
151+
<locales>en</locales>
152+
<outputEncoding>UTF-8</outputEncoding>
153+
</configuration>
154+
</plugin>
155155
<plugin>
156156
<groupId>org.apache.maven.plugins</groupId>
157157
<artifactId>maven-javadoc-plugin</artifactId>

0 commit comments

Comments
 (0)