From 5191dc481a3d7f8a0ee5aa394d265ef0a15128e8 Mon Sep 17 00:00:00 2001 From: TheMeinerLP Date: Sun, 21 Jun 2026 19:14:31 +0200 Subject: [PATCH] feat(ci): switch release-please to Maven (java) flow with snapshots Mirror the Vulpes-Backend setup: use the `java` release-type so release-please manages the Maven SNAPSHOT lifecycle (release -> bump to next -SNAPSHOT) and drive the version in gradle.properties via the generic updater. Add the snapshot CI that flow implies, matching the release path: - `version` job reads gradle.properties on non-release pushes - `publish-snapshot` publishes to the snapshot Maven repo (java-client / velocity-plugin already route SNAPSHOT/BETA/ALPHA there) - `build-context-snapshot` + `docker-snapshot` build & push a snapshot image on every non-release push Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/release-please.yml | 66 ++++++++++++++++++++++++++++ release-please-config.json | 6 ++- 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index c9a647b..331ad1e 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -29,6 +29,33 @@ jobs: config-file: release-please-config.json manifest-file: .release-please-manifest.json + # Resolves the current project version from gradle.properties for non-release + # pushes, so the snapshot jobs below know whether (and at which version) to run. + version: + needs: release-please + if: github.event_name == 'push' && needs.release-please.outputs.release_created != 'true' + runs-on: ubuntu-latest + outputs: + version: ${{ steps.read.outputs.version }} + is_snapshot: ${{ steps.read.outputs.is_snapshot }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Read version + id: read + shell: bash + run: | + VERSION="$(grep -E '^version' gradle.properties | head -n1 | cut -d= -f2 | cut -d'#' -f1 | xargs)" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + # Mirror the snapshot routing in the publish build scripts (SNAPSHOT/BETA/ALPHA). + case "$VERSION" in + *SNAPSHOT*|*BETA*|*ALPHA*) IS_SNAPSHOT=true ;; + *) IS_SNAPSHOT=false ;; + esac + echo "is_snapshot=$IS_SNAPSHOT" >> "$GITHUB_OUTPUT" + echo "Resolved version '$VERSION' (snapshot=$IS_SNAPSHOT)" + + # ---- Maven publish ---- publish: needs: release-please if: needs.release-please.outputs.release_created == 'true' @@ -38,6 +65,15 @@ jobs: java-distribution: "temurin" secrets: inherit + publish-snapshot: + needs: [release-please, version] + if: needs.version.outputs.is_snapshot == 'true' + uses: OneLiteFeatherNET/workflows/.github/workflows/gradle-publish.yml@v2.3.0 + with: + java-version: "25.0.3" + java-distribution: "temurin" + secrets: inherit + # Gradle produces the Micronaut optimized Docker context and uploads it as an # artifact for the (toolchain-agnostic) docker-publish job to consume. build-context: @@ -75,3 +111,33 @@ jobs: blob-chunk: "90000000" # ~90 MB, under the 100 MB Cloudflare cap req-concurrent: "4" secrets: inherit + + # ---- Snapshot Docker image (on every non-release push to main) ---- + build-context-snapshot: + name: Build Docker context (snapshot) + needs: [release-please, version] + if: needs.version.outputs.is_snapshot == 'true' + uses: OneLiteFeatherNET/workflows/.github/workflows/gradle-docker-context.yml@v2.3.0 + with: + version: ${{ needs.version.outputs.version }} + gradle-command: "./gradlew jar optimizedBuildLayers optimizedDockerfile -Pversion=$VERSION" + context-path: "backend/build/docker/optimized" + artifact-name: "docker-context-snapshot" + secrets: inherit + + docker-snapshot: + name: Build Docker Artifacts (snapshot) + needs: [version, build-context-snapshot] + permissions: + contents: read + id-token: write # keyless cosign signing via GitHub OIDC + if: needs.version.outputs.is_snapshot == 'true' + uses: OneLiteFeatherNET/workflows/.github/workflows/docker-publish.yml@v2.3.0 + with: + image-name: "onelitefeather/otis" + version: ${{ needs.version.outputs.version }} + context: "backend/build/docker/optimized" + artifact-name: "docker-context-snapshot" + blob-chunk: "90000000" # ~90 MB, under the 100 MB Cloudflare cap + req-concurrent: "4" + secrets: inherit diff --git a/release-please-config.json b/release-please-config.json index f4753ca..bafe3bd 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -7,9 +7,13 @@ "packages": { ".": { "package-name": "otis", + "release-type": "java", "changelog-path": "CHANGELOG.md", "extra-files": [ - "gradle.properties" + { + "type": "generic", + "path": "gradle.properties" + } ] } }