From 639771b9758f1e36c34ed99994ba2c03a0a361ec Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 11 Sep 2021 20:07:17 -0700 Subject: Github Actions (#266) --- .github/workflows/android.yml | 54 ++++++++++++++++++++++++++++++++++++++++++ README.md | 2 +- files/.gitignore | 2 ++ files/github_actions.sh | 9 +++++++ files/kau_github.tar.gpg | Bin 0 -> 4223 bytes sample/build.gradle | 3 +++ 6 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/android.yml create mode 100644 files/github_actions.sh create mode 100644 files/kau_github.tar.gpg diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..25a2499 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,54 @@ +name: Android CI + +on: + push: + branches: [ '*' ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 100 + + - name: Fetch all tags + run: git fetch origin +refs/tags/*:refs/tags/* + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + java-package: jdk + distribution: 'adopt' + cache: gradle + + - name: Validate gradle wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Decrypt secret + if: ${{ false }} + run: | + gpg -d --passphrase "${{ secrets.KAU_TAR_SECRET }}" --batch "files/kau_github.tar.gpg" > "files/kau_github.tar" + tar xvf files/kau_github.tar -C files + + - name: Checkout Gradle Build Cache + if: ${{ steps.self_hosted.outputs.FLAG != 'self-hosted' }} + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + !~/.gradle/wrapper/dists/**/gradle*.zip + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + gradle-${{ runner.os }}- + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Check and Test + run: ./gradlew spotlessCheck lintRelease testReleaseUnitTest diff --git a/README.md b/README.md index 73ba2e4..cfb96a0 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This library contains small helper functions used throughout almost all of my ot KAU is available on JitPack [![](https://jitpack.io/v/ca.allanwang/kau.svg)](https://jitpack.io/#ca.allanwang/kau) -[![Build Status](https://travis-ci.com/AllanWang/KAU.svg?branch=dev)](https://travis-ci.com/AllanWang/KAU) +[![Build Status](https://github.com/AllanWang/KAU/actions/workflows/android.yml/badge.svg?branch=dev)](https://github.com/AllanWang/KAU/actions/workflows/android.yml) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/kotlin-android-utils/localized.svg)](https://crowdin.com/project/kotlin-android-utils) [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![ZenHub](https://img.shields.io/badge/Shipping%20faster%20with-ZenHub-45529A.svg)](https://app.zenhub.com/workspace/o/allanwang/kau/boards) diff --git a/files/.gitignore b/files/.gitignore index e9bf9f6..8791cfa 100644 --- a/files/.gitignore +++ b/files/.gitignore @@ -2,3 +2,5 @@ gplay-keys.json kau.keystore kau.properties update-dev.sh +kau.tar +kau_github.tar diff --git a/files/github_actions.sh b/files/github_actions.sh new file mode 100644 index 0000000..957d0fa --- /dev/null +++ b/files/github_actions.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +# Add appropriate files for encryption +# https://docs.github.com/en/actions/reference/encrypted-secrets#limits-for-secrets + +rm kau_github.tar.gpg +tar cvf kau_github.tar gplay-keys.json kau.keystore kau.properties +gpg --symmetric --cipher-algo AES256 kau_github.tar +rm kau_github.tar \ No newline at end of file diff --git a/files/kau_github.tar.gpg b/files/kau_github.tar.gpg new file mode 100644 index 0000000..15b4060 Binary files /dev/null and b/files/kau_github.tar.gpg differ diff --git a/sample/build.gradle b/sample/build.gradle index c35e512..90a8d10 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -51,6 +51,9 @@ android { keyAlias releaseProps.getProperty('keyAlias') keyPassword releaseProps.getProperty('keyPassword') } + println("Added KAU release signing") + } else { + println("No KAU release signing found") } debug { -- cgit v1.2.3