Skip to content

Instantly share code, notes, and snippets.

@limkhashing
Last active October 29, 2023 18:35
Show Gist options
  • Select an option

  • Save limkhashing/42f3bfebfdaf8bbfb5e77c466ae6dba0 to your computer and use it in GitHub Desktop.

Select an option

Save limkhashing/42f3bfebfdaf8bbfb5e77c466ae6dba0 to your computer and use it in GitHub Desktop.
Gradle submit dependency graph
name: Gradle submit dependency graph
on:
push:
branches: [master]
env:
# Keystore Password
SIGNING_KEYSTORE_PASSWORD: ${{ secrets.SIGNING_KEYSTORE_PASSWORD }}
# Keystore Alias
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
# Keystore Alias Password
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
jobs:
submit-dependency-graph:
runs-on: ubuntu-latest
environment: production
permissions: # The Dependency Submission API requires write permission
contents: write
steps:
- name: Checkout the branch
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17
- name: Create Services Account and configuration files
run: |
mkdir app/src/release
jq -n ${{ secrets.SERVICE_CREDENTIALS_FIREBASE_APP_DISTRIBUTION }} > fave-production-service-account-firebase-app-distribution.json
jq -n ${{ secrets.AGCONNECT_SERVICES }} > app/src/release/agconnect-services.json
jq -n ${{ secrets.GOOGLE_SERVICES }} > app/src/release/google-services.json
- name: Decode Keystore from Base64 and save it to a file
env:
ENCODED_KEYSTORE: ${{ secrets.SIGNING_KEYSTORE }}
run: |
tmp_keystore_directory="${RUNNER_TEMP}"/keystore
mkdir "${tmp_keystore_directory}"
echo $ENCODED_KEYSTORE | base64 -d > "${tmp_keystore_directory}"/keystore.jks
echo "SIGNING_KEYSTORE_FILE_PATH="${tmp_keystore_directory}"/keystore.jks" >> $GITHUB_ENV
- name: Generate dependency graph snapshot and submit
uses: mikepenz/gradle-dependency-submission@v1
env:
SIGNING_KEYSTORE_FILE_PATH: ${{ env.SIGNING_KEYSTORE_FILE_PATH }}
SIGNING_KEYSTORE_PASSWORD: ${{ env.SIGNING_KEYSTORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ env.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ env.SIGNING_KEY_PASSWORD }}
VERSION_CODE: ${{ github.run_number }}
with:
gradle-dependency-path: "app/build.gradle"
gradle-build-module: ":app"
include-build-environment: true
gradle-build-configuration: "releaseCompileClasspath"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment