Skip to content

Instantly share code, notes, and snippets.

@aalmiray
Last active March 26, 2020 10:54
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 aalmiray/78ff1de407a4779b5a5db7793abb7767 to your computer and use it in GitHub Desktop.
Save aalmiray/78ff1de407a4779b5a5db7793abb7767 to your computer and use it in GitHub Desktop.
OCI Gradle Cache plugin
#!/bin/sh
gpg --quiet --batch --yes --decrypt --passphrase="$DECRYPT_PASSPHRASE" \
--output $HOME/.github-secrets.tar .github-secrets.tar.gpg
tar xvf $HOME/.github-secrets.tar
name: Build
on: [push, pull_request]
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
CI: true
COMPARTMENT_ID: ${{ secrets.COMPARTMENT_ID }}
DECRYPT_PASSPHRASE: ${{ secrets.DECRYPT_PASSPHRASE }}
steps:
- uses: actions/checkout@v1
- name: Decrypt secrets
run: ./.github/scripts/decrypt_secret.sh
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-cache-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: actions/cache@v1
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradlew') }}
restore-keys: |
${{ runner.os }}-gradlew-
- uses: eskatos/gradle-command-action@v1
with:
arguments: build -S
buildscript {
repositories {
jcenter()
gradlePluginPortal()
}
dependencies {
classpath 'org.kordamp.gradle:oci-gradle-build-cache-plugin:0.3.0'
}
}
apply plugin: 'org.kordamp.gradle.oci-build-cache'
ext.isCiServer = System.getenv().containsKey('CI')
buildCache {
local {
enabled = !isCiServer
}
remote(org.kordamp.gradle.plugin.buildcache.OCIBuildCache) {
configFile = '.oci/config'
compartmentId = System.getenv()['COMPARTMENT_ID'] ?: '**bogus**'
push = isCiServer
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment