A highly configurable composite action taking care of running a complete CI pipeline on a Gradle project
The workflow is the following:
- Setup java at the version specified by the input parameter
java-version
from the distributorjava-distribution
, configuring also the information for Maven by populating the server username using inputmaven-central-username
, the server password usingmaven-central-password
, the gpg private key usingsigning-key
, and the gpg passphrase usingsigning-password
. - If the runner is Windows, configure the page file
- Enable caching for gradle
- Run
pre-build-command
insideworking-directory
- Run
build-command
insideworking-directory
- Run
check-command
insideworking-directory
- If
should-run-codecov
is set totrue
, then upload coverage informatio to codecov.io - if
should-deploy
is set totrue
, rundeploy-command
insideworking-directory
- Run
clean-command
insideworking-directory
- Turn off the gradle daemon gracefully by running
gradle-termination-command
insideworking-directory
- Force kill remaining daemons
- Cleanup the Gradle cache
In the following examples, all values but secrets are set to their default. If you are fine with the default value, just omit the parameter.
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
- uses: DanySK/[email protected]
with:
pre-build-command: 'true'
build-command: ./gradlew assemble --parallel
check-command: ./gradlew check --parallel
clean-command: 'true'
deploy-command: ./gradlew publish --parallel
enable-cache: true
retries-on-failure: 2
wait-between-retries: 5
gradle-termination-command: ./gradlew --stop
java-distribution: temurin
java-version: '17'
should-run-codecov: true
should-deploy: false
maven-central-username: 'danysk'
maven-central-password:
maven-central-repo: 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/'
working-directory: '.'
custom-secret-0: ''
custom-secret-1: ''
custom-secret-2: ''
custom-secret-3: ''
custom-secret-4: ''
github-token: ${{ github.token }}
gradle-publish-secret:
gradle-publish-key:
signing-key:
signing-password:
npm-repo: 'https://registry.npmjs.org'
npm-token: