Update gradle/wrapper-validation-action action to v2.0.1 #802
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 | |
on: [push, pull_request] | |
env: | |
GRADLE_OPTS: "-Dorg.gradle.internal.launcher.welcomeMessageEnabled=false" | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
validate-gradle-wrapper: | |
name: "Validate Gradle wrapper" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out code | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Validate Gradle wrapper | |
uses: gradle/[email protected] | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- windows-2022 | |
- macos-11 | |
name: "Test (${{ matrix.os }})" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Check out code | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK | |
uses: actions/[email protected] | |
with: | |
java-version: 11.0.14+101 # We must use Java 15 or earlier until https://youtrack.jetbrains.com/issue/KT-47039 is fixed. | |
distribution: adopt | |
- name: Cache Gradle | |
id: cache-gradle | |
uses: actions/[email protected] | |
with: | |
path: ~/.gradle/wrapper/dists | |
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/*') }} | |
- name: Cache packages | |
id: cache-packages | |
uses: actions/[email protected] | |
with: | |
path: ~/.gradle/caches | |
key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle.kts', 'gradle/wrapper/*') }} | |
restore-keys: gradle-packages-${{ runner.os }} | |
- name: Allow modifying macOS certificate trust settings without prompting | |
if: startsWith(matrix.os, 'macos') | |
run: sudo security authorizationdb write com.apple.trust-settings.user allow | |
- name: Build and test | |
run: ./gradlew --parallel check | |
- name: Clean up dependencies before caching | |
if: steps.cache-packages.outputs.cache-hit != 'true' | |
run: | | |
rm -rf ~/.gradle/caches/gradle-cache/caches/modules-2/modules-2.lock | |
rm -rf ~/.gradle/caches/gradle-cache/caches/*/plugin-resolution/ | |
rm -rf ~/.gradle/caches/gradle-cache/caches/*/scripts/ | |
rm -rf ~/.gradle/caches/gradle-cache/caches/*/scripts-remapped/ | |
rm -rf ~/.gradle/caches/gradle-cache/caches/*/fileHashes/ | |
rm -rf ~/.gradle/caches/gradle-cache/caches/*/fileContent/*.lock | |
rm -rf ~/.gradle/caches/gradle-cache/caches/*/javaCompile/*.lock | |
rm -rf ~/.gradle/caches/gradle-cache/caches/*/executionHistory/*.lock | |
rm -rf ~/.gradle/caches/gradle-cache/caches/*/generated-gradle-jars/*.lock | |
rm -rf ~/.gradle/caches/gradle-cache/caches/jars-*/*.lock | |
rm -rf ~/.gradle/caches/gradle-cache/caches/transforms-1/transforms-1.lock | |
rm -rf ~/.gradle/caches/gradle-cache/caches/journal-1/file-access.bin | |
rm -rf ~/.gradle/caches/gradle-cache/caches/journal-1/*.lock | |
rm -rf ~/.gradle/caches/gradle-cache/daemon/*/*.lock | |
rm -rf ~/.gradle/caches/gradle-cache/daemon/*/*.log | |
rm -rf ~/.gradle/caches/gradle-cache/kotlin-profile/* | |
publish: | |
name: "Publish" | |
runs-on: ubuntu-22.04 | |
if: github.repository == 'charleskorn/okhttp-system-keystore' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) | |
needs: | |
- test | |
- validate-gradle-wrapper | |
env: | |
SONATYPE_USERNAME: okhttp-system-keystore-github-actions | |
steps: | |
- name: Check out code | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK | |
uses: actions/[email protected] | |
with: | |
java-version: 11 # We must use Java 15 or earlier until https://youtrack.jetbrains.com/issue/KT-47039 is fixed. | |
distribution: adopt | |
- name: Cache Gradle | |
id: cache-gradle | |
uses: actions/[email protected] | |
with: | |
path: ~/.gradle/wrapper/dists | |
key: gradle-wrapper-${{ hashFiles('gradle/wrapper/*') }} | |
- name: Cache packages | |
id: cache-packages | |
uses: actions/[email protected] | |
with: | |
path: ~/.gradle/caches | |
key: gradle-packages-${{ runner.os }}-${{ hashFiles('**/*.gradle.kts', 'gradle/wrapper/*') }} | |
restore-keys: gradle-packages-${{ runner.os }} | |
- name: Publish snapshot | |
run: ./gradlew publishSnapshot | |
env: | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ env.SONATYPE_USERNAME }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_KEY_PASSPHRASE }} | |
if: github.repository == 'charleskorn/okhttp-system-keystore' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
- name: Publish release | |
run: ./gradlew publishRelease | |
env: | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ env.SONATYPE_USERNAME }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_KEY_PASSPHRASE }} | |
if: github.repository == 'charleskorn/okhttp-system-keystore' && startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' |