8000 Enable branch-specific versions in internal maven repo (#44) · Labs64/NetLicensingClient-java@fe887fc · GitHub
[go: up one dir, main page]

Skip to content

Commit fe887fc

Browse files
authored
Enable branch-specific versions in internal maven repo (#44)
1 parent 1f06ce0 commit fe887fc

File tree

5 files changed

+46
-5
lines changed

5 files changed

+46
-5
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,6 @@ jobs:
5151
clean deploy scm:tag \
5252
-P release \
5353
-Drevision=${{ github.event.inputs.release-version }} \
54+
-Dchangelist= \
5455
-Dmessage="Release ${{ github.event.inputs.release-version }}" \
5556
-Dgpg.passphrase=${{ secrets.GPG_KEY_PASS }}

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

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,55 @@ jobs:
2626
strategy:
2727
matrix:
2828
java-version: [11, 17]
29+
include:
30+
- java-version: 11
31+
mvn-goal: deploy
32+
- java-version: 17
33+
mvn-goal: verify
34+
2935

3036
steps:
3137
- uses: actions/checkout@v3
38+
3239
- name: Set up JDK ${{ matrix.java-version }}
3340
uses: actions/setup-java@v3
3441
with:
3542
java-version: ${{ matrix.java-version }}
3643
distribution: 'adopt'
3744
cache: maven
45+
46+
- name: Prepare maven settings.xml
47+
run: |
48+
mkdir -p ~/.m2
49+
cat << EOF >~/.m2/settings.xml
50+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
51+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
52+
<servers>
53+
<server>
54+
<id>nlic-snapshots</id>
55+
<username>${{ secrets.SNAPSHOTS_USER }}</username>
56+
<password>${{ secrets.SNAPSHOTS_PASS }}</password>
57+
</server>
58+
</servers>
59+
</settings>
60+
EOF
61+
62+
- name: Calculate branch suffix
63+
run: |
64+
if [ "$GITHUB_REF_NAME" = "master" ]
65+
then
66+
# No suffix when running against "master" branch
67+
BRANCH_SUFFIX=
68+
else
69+
# When running from pull request, use "-pr-<N>" suffix, where <N> is a PR number
70+
BRANCH_SUFFIX=-pr-${GITHUB_REF_NAME//\/merge/}
71+
fi
72+
echo "Branch suffix: '$BRANCH_SUFFIX'"
73+
echo "BRANCH_SUFFIX=$BRANCH_SUFFIX" >> "$GITHUB_ENV"
74+
3875
- name: Build with Maven
39-
run: mvn -B clean verify
76+
run: mvn -B clean ${{ matrix.mvn-goal }} -Drepo.snapshots.url=${{ secrets.SNAPSHOTS_URL }} -Dsha1=$BRANCH_SUFFIX
77+
4078
- name: Run Demo App
4179
run: |
4280
ls -la NetLicensingClient-demo/target/

NetLicensingClient-demo/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.labs64.netlicensing</groupId>
88
<artifactId>netlicensing-client-parent</artifactId>
9-
<version>${revision}</version>
9+
<version>${revision}${sha1}${changelist}</version>
1010
</parent>
1111

1212
<artifactId>netlicensing-client-demo</artifactId>

NetLicensingClient/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.labs64.netlicensing</groupId>
88
<artifactId>netlicensing-client-parent</artifactId>
9-
<version>${revision}</version>
9+
<version>${revision}${sha1}${changelist}</version>
1010
</parent>
1111

1212
<artifactId>netlicensing-client</artifactId>

pom.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>com.labs64.netlicensing</groupId>
66
<artifactId>netlicensing-client-parent</artifactId>
7-
<version>${revision}</version>
7+
<version>${revision}${sha1}${changelist}</version>
88
<packaging>pom</packaging>
99
<name>Labs64 :: NetLicensing :: Client :: Parent</name>
1010
<url>https://netlicensing.io</url>
@@ -63,7 +63,9 @@
6363
</modules>
6464

6565
<properties>
66-
<revision>2.10.0-SNAPSHOT</revision>
66+
<revision>2.10.0</revision>
67+
<changelist>-SNAPSHOT</changelist>
68+
<sha1/>
6769
<project.title>${project.name}</project.title>
6870
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6971

0 commit comments

Comments
 (0)
0