v3.8.5 #453
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: [push, pull_request] | |
env: | |
GRADLE_OPTS: -Dorg.gradle.daemon=false -Dkotlin.incremental=false -Dkotlin.compiler.execution.strategy=in-process | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
is_snapshot: ${{ steps.setup.outputs.is_snapshot }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Gradle Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-v2-gradle-build-${{ hashFiles('**/*') }} | |
restore-keys: | | |
${{ runner.os }}-v2-gradle-build- | |
${{ runner.os }}-v2-gradle- | |
- name: Validate Gradle integrity | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Setup environment | |
id: setup | |
run: ./gradlew configureGithubActions | |
- name: Build project | |
run: | | |
./gradlew assemble publishToMavenLocal -S | |
cd testapp && ./gradlew help -PskipValidation -S | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Gradle Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-v2-gradle-test-${{ hashFiles('**/*') }} | |
restore-keys: | | |
${{ runner.os }}-v2-gradle-test- | |
${{ runner.os }}-v2-gradle- | |
- name: Setup environment | |
run: ./gradlew publishToMavenLocal | |
- name: Run tests | |
run: ./gradlew check test -S | |
deploy_snapshot: | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/master' && needs.build.outputs.is_snapshot == 'true' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Gradle Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-v2-gradle-deploy-snapshot-${{ hashFiles('**/*') }} | |
restore-keys: | | |
${{ runner.os }}-v2-gradle-deploy-snapshot- | |
${{ runner.os }}-v2-gradle-deploy- | |
${{ runner.os }}-v2-gradle- | |
- name: Build project | |
run: ./gradlew assemble | |
- name: Publish snapshot | |
run: ./gradlew publishToSonatype | |
env: | |
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
deploy_release: | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Gradle Cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-v2-gradle-deploy-release-${{ hashFiles('**/*') }} | |
restore-keys: | | |
${{ runner.os }}-v2-gradle-deploy-release- | |
${{ runner.os }}-v2-gradle-deploy- | |
${{ runner.os }}-v2-gradle- | |
- name: Build project | |
run: ./gradlew assemble | |
- name: Publish release | |
run: | | |
./gradlew publishToSonatype closeAndReleaseStagingRepository | |
./gradlew publishPlugins \ | |
-Pgradle.publish.key=$PUBLISH_KEY -Pgradle.publish.secret=$PUBLISH_SECRET | |
env: | |
PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }} | |
PUBLISH_SECRET: ${{ secrets.PUBLISH_SECRET }} | |
SONATYPE_NEXUS_USERNAME: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | |
SONATYPE_NEXUS_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | |
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} |