Skip to content

Commit dbd0bca

Browse files
committed
ci: reusable-workflow callers, snapshot publishing, release all modules
- Repoint distributionManagement URLs (all 3 poms) to labs64.io-releases/ and labs64.io-snapshots (includes auth-context-java, not just the two poms getting new profiles -- required for the release workflow to deploy to the correct Nexus repos). - Add release + central profiles to openapi-spring-boot-starter and authz-queryplan-jpa poms. - Introduce auth-context.version property in authz-queryplan-jpa. - Migrate labs64io-ci.yml to reusable java-ci/python-ci callers plus snapshot publishing jobs gated on master pushes. - Rewrite labs64io-release.yml to release all three modules to Nexus (dependency order) then optionally to Maven Central.
1 parent 9125573 commit dbd0bca

5 files changed

Lines changed: 276 additions & 91 deletions

File tree

.github/workflows/labs64io-ci.yml

Lines changed: 58 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,68 @@ permissions:
1515
contents: read
1616

1717
jobs:
18-
java:
19-
runs-on: ubuntu-latest
20-
steps:
21-
- uses: actions/checkout@v4
22-
- uses: actions/setup-java@v4
23-
with:
24-
distribution: temurin
25-
java-version: "21"
26-
cache: maven
27-
- name: Test auth-context-java
28-
run: cd auth-context-java && mvn -B -ntp test
29-
- name: Install auth-context-java (dependency for authz-queryplan-jpa)
30-
run: cd auth-context-java && mvn -B -ntp -DskipTests install
31-
- name: Test openapi-spring-boot-starter
32-
run: cd openapi-spring-boot-starter && mvn -B -ntp test
33-
- name: Test authz-queryplan-jpa
34-
run: cd authz-queryplan-jpa && mvn -B -ntp test
18+
auth-context:
19+
uses: Labs64/labs64.io-workspace/.github/workflows/java-ci.yml@master
20+
with:
21+
working-directory: auth-context-java
22+
maven-goals: test
23+
24+
openapi-starter:
25+
uses: Labs64/labs64.io-workspace/.github/workflows/java-ci.yml@master
26+
with:
27+
working-directory: openapi-spring-boot-starter
28+
maven-goals: test
29+
30+
authz-queryplan:
31+
uses: Labs64/labs64.io-workspace/.github/workflows/java-ci.yml@master
32+
with:
33+
working-directory: authz-queryplan-jpa
34+
pre-install-dirs: auth-context-java
35+
maven-goals: test
3536

3637
python:
37-
runs-on: ubuntu-latest
38-
steps:
39-
- uses: actions/checkout@v4
40-
- uses: actions/setup-python@v5
41-
with:
42-
python-version: "3.13"
43-
- name: Test auth-context-python
44-
run: |
45-
cd auth-context-python
46-
pip install -q -e ".[dev]"
47-
pytest -q
48-
49-
# Generate the reference Cerbos policy set
50-
# from the SAME x-labs64-auth (F3, no-drift) and run cerbos compile + the
51-
# truth-table suite — including the cross-tenant isolation invariant (F4/F8).
38+
uses: Labs64/labs64.io-workspace/.github/workflows/python-ci.yml@master
39+
with:
40+
working-directory: auth-context-python
41+
install-command: pip install -q -e ".[dev]"
42+
test-command: pytest -q
43+
44+
# Cerbos policy generation from x-labs64-auth + compile + truth-table gate
45+
# (repo-specific — stays inline).
5246
cerbos:
5347
runs-on: ubuntu-latest
5448
steps:
55-
- uses: actions/checkout@v4
49+
- uses: actions/checkout@v7
5650
- name: Cerbos compile + decision-equivalence truth-table gate
5751
run: ./auth-policy-cerbos/validate.sh
52+
53+
# ── Snapshot publishing: only after ALL tests green, only on master pushes.
54+
# maven-publish skips silently when the pom version is not a -SNAPSHOT.
55+
snapshot-auth-context:
56+
needs: [auth-context, openapi-starter, authz-queryplan, python, cerbos]
57+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
58+
uses: Labs64/labs64.io-workspace/.github/workflows/maven-publish.yml@master
59+
with:
60+
working-directory: auth-context-java
61+
mode: snapshot
62+
secrets: inherit
63+
64+
snapshot-openapi-starter:
65+
needs: [auth-context, openapi-starter, authz-queryplan, python, cerbos]
66+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
67+
uses: Labs64/labs64.io-workspace/.github/workflows/maven-publish.yml@master
68+
with:
69+
working-directory: openapi-spring-boot-starter
70+
mode: snapshot
71+
secrets: inherit
72+
73+
# needs snapshot-auth-context so a same-push snapshot of the dependency is
74+
# already in Nexus if auth-context.version points at a -SNAPSHOT.
75+
snapshot-authz-queryplan:
76+
needs: [snapshot-auth-context]
77+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
78+
uses: Labs64/labs64.io-workspace/.github/workflows/maven-publish.yml@master
79+
with:
80+
working-directory: authz-queryplan-jpa
81+
mode: snapshot
82+
secrets: inherit
Lines changed: 66 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,73 @@
11
name: 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

1110
on:
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

1825
permissions:
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+
2135
jobs:
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>
@@ -72,7 +78,6 @@ jobs:
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}"

auth-context-java/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@
2727
<repository>
2828
<id>labs64-nexus</id>
2929
<name>Labs64 Nexus Releases</name>
30-
<url>https://nexus.labs64.com/repository/maven-releases/</url>
30+
<url>https://nexus.labs64.com/repository/labs64.io-releases/</url>
3131
</repository>
3232
<snapshotRepository>
3333
<id>labs64-nexus-snapshots</id>
3434
<name>Labs64 Nexus Snapshots</name>
35-
<url>https://nexus.labs64.com/repository/maven-snapshots/</url>
35+
<url>https://nexus.labs64.com/repository/labs64.io-snapshots/</url>
3636
</snapshotRepository>
3737
</distributionManagement>
3838

0 commit comments

Comments
 (0)