11name : Labs64.IO - Commons - Release
22
3- # Releases the Java auth-context library to BOTH:
4- # * Labs64 Nexus (server id: labs64-nexus <- L64_PUB_CI_USERNAME / L64_PUB_CI_PASSWORD)
5- # * Maven Central (server id: ossrh <- OSS_USER / OSS_PASS)
6- # Artifacts are GPG-signed with GPG_KEY / GPG_KEY_PASS.
7- #
8- # The Python library (auth-context-python) is consumed via git+https and is not
9- # published to a package index here.
3+ # Releases ALL commons Java modules to Labs64 Nexus in dependency order:
4+ # auth-context-java -> openapi-spring-boot-starter -> authz-queryplan-jpa
5+ # Maven Central publishing (central profile, auth-context only for now) is
6+ # opt-in via the publish-central input ("later" per spec).
7+ # After deploying: commit + tag v<version>, then bump master to next -SNAPSHOT
8+ # (auth-context.version property in authz-queryplan-jpa stays at the release).
109
1110on :
1211 workflow_dispatch :
1312 inputs :
1413 release-version :
1514 required : true
16- description : The release version X.Y.Z
15+ description : The release version X.Y.Z (applied to all modules)
16+ next-version :
17+ required : false
18+ default : " "
19+ description : Next dev version (default X.<minor+1>.0-SNAPSHOT)
20+ publish-central :
21+ type : boolean
22+ default : true
23+ description : Also publish all modules to Maven Central
1724
1825permissions :
1926 contents : write
2027
28+ concurrency :
29+ group : commons-release
30+ cancel-in-progress : false
31+
32+ env :
33+ MODULES : " auth-context-java openapi-spring-boot-starter authz-queryplan-jpa"
34+
2135jobs :
2236 release :
2337 name : Release ${{ github.event.inputs.release-version }}
2438 runs-on : ubuntu-latest
25-
2639 env :
27- # Bind the dispatch input to an env var once, then reference "$RELEASE_VERSION"
28- # in shell — never interpolate the raw ${{ ... }} expression into a run: script.
2940 RELEASE_VERSION : ${{ github.event.inputs.release-version }}
30-
41+ NEXT_VERSION : ${{ github.event.inputs.next-version }}
42+ L64_PUB_CI_USERNAME : ${{ secrets.L64_PUB_CI_USERNAME }}
43+ L64_PUB_CI_PASSWORD : ${{ secrets.L64_PUB_CI_PASSWORD }}
44+ MAVEN_GPG_PASSPHRASE : ${{ secrets.GPG_KEY_PASS }}
3145 steps :
3246 - name : Validate release version
3347 run : |
3448 if ! [[ "$RELEASE_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
35- echo "Invalid release version '$RELEASE_VERSION' (expected X.Y.Z)"
36- exit 1
49+ echo "Invalid release version '$RELEASE_VERSION' (expected X.Y.Z)"; exit 1
3750 fi
3851
39- - name : Checkout the sources
40- uses : actions/checkout@v4
52+ - uses : actions/checkout@v7
4153
42- - name : Set up JDK 17
43- uses : actions/setup-java@v4
54+ - uses : actions/setup-java@v5
4455 with :
4556 distribution : temurin
46- java-version : " 17 "
57+ java-version : " 25 "
4758 cache : maven
4859
4960 - name : Configure Git
5061 run : |
5162 git config user.name "GitHub Actions Bot"
5263 git config user.email "netlicensing@labs64.com"
5364
54- # settings.xml references credentials by env-var placeholder (${env.NAME}); the
55- # real values are injected per-deploy-step below, never written to disk.
5665 - name : Prepare Maven settings.xml
5766 run : |
5867 mkdir -p ~/.m2
5968 cat > ~/.m2/settings.xml <<'EOF'
60- <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
61- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
62- xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
69+ <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0">
6370 <servers>
64- <!-- Labs64 Nexus (releases + snapshots share one credential) -->
6571 <server>
6672 <id>labs64-nexus</id>
6773 <username>${env.L64_PUB_CI_USERNAME}</username>
7278 <username>${env.L64_PUB_CI_USERNAME}</username>
7379 <password>${env.L64_PUB_CI_PASSWORD}</password>
7480 </server>
75- <!-- Sonatype Central Portal -->
7681 <server>
7782 <id>ossrh</id>
7883 <username>${env.OSS_USER}</username>
@@ -87,39 +92,49 @@ jobs:
8792 echo "${{ secrets.GPG_KEY }}" | base64 -d | \
8893 gpg --batch --pinentry-mode loopback --passphrase "${{ secrets.GPG_KEY_PASS }}" --import
8994
90- - name : Set release version
91- working-directory : auth-context-java
92- run : mvn -B -ntp versions:set -DnewVersion="$RELEASE_VERSION" -DgenerateBackupPoms=false
95+ - name : Set release versions
96+ run : |
97+ for m in $MODULES; do
98+ (cd "$m" && mvn -B -ntp versions:set -DnewVersion="$RELEASE_VERSION" -DgenerateBackupPoms=false)
99+ done
100+ (cd authz-queryplan-jpa && mvn -B -ntp versions:set-property \
101+ -Dproperty=auth-context.version -DnewVersion="$RELEASE_VERSION" -DgenerateBackupPoms=false)
93102
94- # Nexus: default maven-deploy-plugin honours <distributionManagement> (labs64-nexus).
95- - name : Deploy to Labs64 Nexus
96- working-directory : auth-context-java
97- env :
98- L64_PUB_CI_USERNAME : ${{ secrets.L64_PUB_CI_USERNAME }}
99- L64_PUB_CI_PASSWORD : ${{ secrets.L64_PUB_CI_PASSWORD }}
100- MAVEN_GPG_PASSPHRASE : ${{ secrets.GPG_KEY_PASS }}
103+ - name : Deploy modules to Labs64 Nexus (dependency order)
101104 run : |
102- mvn -B -ntp -s ~/.m2/settings.xml \
103- clean deploy \
104- -P release
105+ for m in $MODULES; do
106+ echo "== deploy $m $RELEASE_VERSION"
107+ (cd "$m" && mvn -B -ntp -s ~/.m2/settings.xml clean deploy -P release)
108+ done
105109
106- # Maven Central: the `central` profile's central-publishing-maven-plugin takes
107- # over the deploy phase (extensions=true), so this does not re-push to Nexus.
108- - name : Publish to Maven Central
109- working-directory : auth-context-java
110+ # Central runs AFTER the Nexus deploy so a Central failure never loses
111+ # the Nexus release. central-publishing-maven-plugin (extensions=true)
112+ # takes over deploy, so this does not re-push to Nexus.
113+ - name : Publish modules to Maven Central
114+ if : github.event.inputs.publish-central == 'true'
110115 env :
111116 OSS_USER : ${{ secrets.OSS_USER }}
112117 OSS_PASS : ${{ secrets.OSS_PASS }}
113- MAVEN_GPG_PASSPHRASE : ${{ secrets.GPG_KEY_PASS }}
114118 run : |
115- mvn -B -ntp -s ~/.m2/settings.xml \
116- clean deploy \
117- -P release,central
119+ for m in $MODULES; do
120+ echo "== central publish $m $RELEASE_VERSION"
121+ (cd "$m" && mvn -B -ntp -s ~/.m2/settings.xml clean deploy -P release,central)
122+ done
118123
119- - name : Commit and tag version bump
124+ - name : Commit, tag, bump to next snapshot
120125 run : |
121- git add auth-context-java/pom.xml
122- git diff-index --quiet HEAD || git commit -m "chore: release auth-context ${RELEASE_VERSION}"
123- git tag -a "v${RELEASE_VERSION}" -m "Release ${RELEASE_VERSION}" || true
126+ git add $(for m in $MODULES; do echo "$m/pom.xml"; done)
127+ git commit -m "chore: release commons ${RELEASE_VERSION}"
128+ git tag -a "v${RELEASE_VERSION}" -m "Release ${RELEASE_VERSION}"
129+ if [[ -z "$NEXT_VERSION" ]]; then
130+ IFS=. read -r MA MI PA <<< "$RELEASE_VERSION"
131+ NEXT_VERSION="${MA}.$((MI+1)).0-SNAPSHOT"
132+ fi
133+ echo "Next dev version: $NEXT_VERSION"
134+ for m in $MODULES; do
135+ (cd "$m" && mvn -B -ntp versions:set -DnewVersion="$NEXT_VERSION" -DgenerateBackupPoms=false)
136+ done
137+ git add $(for m in $MODULES; do echo "$m/pom.xml"; done)
138+ git commit -m "chore: start ${NEXT_VERSION}"
124139 git push origin "HEAD:${GITHUB_REF_NAME}"
125140 git push origin "v${RELEASE_VERSION}"
0 commit comments