Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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:
Expand Down Expand Up @@ -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
6 changes: 5 additions & 1 deletion release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
"packages": {
".": {
"package-name": "otis",
"release-type": "java",
"changelog-path": "CHANGELOG.md",
"extra-files": [
"gradle.properties"
{
"type": "generic",
"path": "gradle.properties"
}
]
}
}
Expand Down
Loading