Reusable GitHub Actions workflows shared across all problem4j repositories.
See workflow - link.
Builds the project with Gradle. Code style check runs as a separate, conditional step before the build, which allows
enabling it only on selected Java versions (formatters such as google-java-format resolve to different versions
depending on Java version, which may result in different formatting). The code style task is excluded from the build
step.
| Input | Type | Required | Default | Description |
|---|---|---|---|---|
java-version |
number |
no | 25 |
Java version to build with (e.g. 17, 21, 25). |
code-style-enabled |
boolean |
no | true |
Whether to run code style check step. |
code-style-task |
string |
no | spotlessCheck |
Gradle task verifying code style. |
codecov-enabled |
boolean |
no | false |
Whether to upload JaCoCo report to Codecov. |
codecov-files |
string |
no | "" |
JaCoCo files to upload to Codecov. |
Usage:
jobs:
build:
name: Build (Java ${{ matrix.java }})
strategy:
fail-fast: false
matrix:
java: [17, 21, 25]
uses: problem4j/problem4j-workflows/.github/workflows/ci.yml@v1
with:
java-version: ${{ matrix.java }}
code-style-enabled: ${{ matrix.java >= 21 }}
codecov-enabled: ${{ matrix.java == 25 }}
codecov-files: "build/reports/jacoco/test/jacocoTestReport.xml"
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}See workflow - link.
Generates and submits the Gradle dependency graph to GitHub for dependency review and Dependabot alerts.
| Input | Type | Required | Default | Description |
|---|---|---|---|---|
java-version |
number |
no | 25 |
Java version to use. |
Usage:
jobs:
dependency-submission:
name: Dependency Submission
permissions:
contents: write
uses: problem4j/problem4j-workflows/.github/workflows/gradle-dependency-submission.yml@v1See workflow - link.
Publishes a release to Maven Central using the nmcp Gradle
plugin. Triggered by a version tag push; extracts the version from the tag name (strips the leading v).
| Input | Type | Required | Default | Description |
|---|---|---|---|---|
java-version |
number |
no | 25 |
Java version to use. |
publish-task |
string |
yes | — | Gradle publish task to run. |
| Secret | Required | Description |
|---|---|---|
SIGNING_KEY |
yes | GPG signing key |
SIGNING_PASSWORD |
yes | GPG signing password |
PUBLISHING_USERNAME |
yes | Maven Central (Sonatype) tokenized username |
PUBLISHING_PASSWORD |
yes | Maven Central (Sonatype) tokenized password |
The publish-task depends on the repository structure:
- Single-module repositories use
publishAllPublicationsToCentralPortal(e.g.problem4j-core). - Multi-module repositories with an aggregation publication use
publishAggregationToCentralPortal(e.g.problem4j-spring).
Usage:
jobs:
publish-release:
name: Publish Release
uses: problem4j/problem4j-workflows/.github/workflows/release.yml@v1
with:
publish-task: publishAllPublicationsToCentralPortal
secrets: inheritSetting secrets: inherit forwards all secrets from the calling workflow to the reusable workflow
automatically, without mapping each one individually.
Workflows are versioned with vX.Y.Z Git tags. Each release also moves the major version tag vX to the highest
release of that major version, so callers should reference the major version tag (e.g. @v1) and receive compatible
changes automatically. A new major version means breaking changes for callers, such as renamed or removed workflows,
inputs or secrets.
New releases are made with release-workflows.yml workflow, triggered manually from main branch with the version
part to bump (patch, minor or major). It computes the next version from the highest vX.Y.Z tag, pushes it as an
annotated tag and moves the vX tag. No GitHub releases are created. Run it from the
workflow page (Run workflow button).
GitHub requires reusable workflows to reside in .github/workflows/ directory. All workflows there are reusable ones
(triggered only by workflow_call), except for release-workflows.yml, which releases this repository.