Skip to content

Instantly share code, notes, and snippets.

@teyckmans
Last active June 13, 2019 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teyckmans/9a9e614f66b32170870b125db74112f7 to your computer and use it in GitHub Desktop.
Save teyckmans/9a9e614f66b32170870b125db74112f7 to your computer and use it in GitHub Desktop.
GitLab CI file for Gradle build with build/check/publish stages
image: adoptopenjdk/openjdk12:alpine
stages:
- build
- check
- publish
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
before_script:
- echo `pwd`
- export GRADLE_USER_HOME=`pwd`/.gradle
- rm -f .gradle/caches/modules-2/modules-2.lock
- rm -fr .gradle/caches/*/plugin-resolution/
cache:
untracked: true
paths:
- .gradle/wrapper
- .gradle/caches
- "*/build"
build:
stage: build
script:
- ./gradlew build -x check
artifacts:
paths:
- "*/build/libs/*.jar"
expire_in: 1 week
check:
stage: check
script:
- ./gradlew check
artifacts:
reports:
junit: "*/build/test-results/test/TEST-*.xml"
expire_in: 1 week
bintray upload:
stage: publish
script:
- ./gradlew -Pversion=$CI_COMMIT_TAG bintrayUpload
- ls */build/libs/*.jar
only:
- tags
gradle plugin publish:
stage: publish
script:
- ./gradlew publishPlugins -Pversion=$CI_COMMIT_TAG -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET
- ls */build/libs/*.jar
only:
- tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment