diff --git a/.github/decrypt_secrets.sh b/.github/decrypt_secrets.sh new file mode 100644 index 00000000..289d3ffb --- /dev/null +++ b/.github/decrypt_secrets.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +gpg --quiet --batch --yes --decrypt --passphrase="$SECRETS_GPG_PASS" --output .github/secrets.tar .github/secrets.tar.gpg +tar xvf .github/secrets.tar -C .github \ No newline at end of file diff --git a/.github/secrets.tar.gpg b/.github/secrets.tar.gpg new file mode 100644 index 00000000..e515bf6a Binary files /dev/null and b/.github/secrets.tar.gpg differ diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 00000000..54a1b468 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,49 @@ +name: Android CI + +on: + push: + branches: [ master ] + tags: + - 'v*' + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission to scripts + run: chmod +x gradlew .github/decrypt_secrets.sh + - name: Decrypt GPG secrets + run: .github/decrypt_secrets.sh + env: + SECRETS_GPG_PASS: ${{ secrets.SECRETS_GPG_PASS }} + - name: Build with Gradle + if: ${{ !startsWith(github.ref, 'refs/tags/v') }} + run: ./gradlew connectedCheck --no-daemon + - name: Publish with Gradle + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + run: ./gradlew assembleRelease publish --no-daemon + env: + KEYSTORE_STORE_PASS: ${{ secrets.KEYSTORE_STORE_PASS }} + KEYSTORE_KEY_ALIAS: gianlu + KEYSTORE_KEY_PASS: ${{ secrets.KEYSTORE_KEY_PASS }} + - name: Create release + if: ${{ startsWith(github.ref, 'refs/tags/v') }} + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body_path: app/src/main/play/release-notes/en-GB/production.txt + draft: true + prerelease: false \ No newline at end of file diff --git a/.gitignore b/.gitignore index 26c97f47..ec790ac5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,4 @@ /app/build /app/**/release/ local.properties -google-services.json -!/app/src/foss/google-services.json *.iml \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 29e58b86..00000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: android -android: - components: - - platform-tools - - build-tools-29.0.3 - - android-29 - - extra-google-google_play_services - -before_install: - - openssl aes-256-cbc -K $encrypted_66845d59e2a6_key -iv $encrypted_66845d59e2a6_iv - -in .travis/secrets.tar.enc -out .travis/secrets.tar -d - - tar xvf .travis/secrets.tar -C .travis - - chmod +x gradlew .travis/*.sh - - cp .travis/google-services.json app - -script: - - .travis/build.sh - -before_deploy: - - export RELEASE_NOTES=$(cat app/src/main/play/release-notes/en-GB/production.txt) - - export RELEASE_NAME=$(./gradlew -q :app:printVersionName) - -deploy: - - provider: script - script: ./.travis/github-release.sh - skip_cleanup: true - on: - repo: devgianlu/PretendYoureXyzzyAndroid - branch: master - tags: true - -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ - -cache: - directories: - - "$HOME/.gradle/caches/" - - "$HOME/.gradle/wrapper/" - - "$HOME/.android/build-cache" diff --git a/.travis/build.sh b/.travis/build.sh deleted file mode 100644 index a0a189cb..00000000 --- a/.travis/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -ev - -if [[ -z "${TRAVIS_TAG}" ]]; then - ./gradlew build connectedCheck -else - ./gradlew assembleRelease publish --stacktrace -fi \ No newline at end of file diff --git a/.travis/github-release.sh b/.travis/github-release.sh deleted file mode 100644 index 00a42cbb..00000000 --- a/.travis/github-release.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -ev - -# Download and extract aktau/github-release -curl https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 -L --output linux-amd64-github-release.tar.bz2 -tar -xvf linux-amd64-github-release.tar.bz2 -mv ./bin/linux/amd64/github-release ./github-release-bin -chmod +x github-release-bin - -# Split repo slug into owner and name -IFS=/ read REPO_USER REPO_NAME <<< $TRAVIS_REPO_SLUG - -echo $REPO_USER - -# Create release -./github-release-bin release -s "${GITHUB_OAUTH_TOKEN}" -u "${REPO_USER}" -r "${REPO_NAME}" -t "${TRAVIS_TAG}" -n "${RELEASE_NAME}" -d "${RELEASE_NOTES}" --draft \ No newline at end of file diff --git a/.travis/secrets.tar.enc b/.travis/secrets.tar.enc deleted file mode 100644 index 8c90f68f..00000000 Binary files a/.travis/secrets.tar.enc and /dev/null differ diff --git a/app/build.gradle b/app/build.gradle index c388d81a..e2081f3a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ plugins { apply plugin: 'com.android.application' apply plugin: 'com.google.firebase.crashlytics' -def isTravis = System.getenv("CI") == "true" +def isCi = System.getenv("CI") == "true" android { compileSdkVersion 29 buildToolsVersion "29.0.3" @@ -18,13 +18,13 @@ android { versionName "5.0.4" } - if (isTravis) { + if (isCi) { signingConfigs { release { - storeFile file("../.travis/keystore.jks") - storePassword System.getenv("keystore_storePsswd") - keyAlias = System.getenv("keystore_keyAlias") - keyPassword System.getenv("keystore_keyPsswd") + storeFile file("../.github/keystore.jks") + storePassword System.getenv("KEYSTORE_STORE_PASS") + keyAlias = System.getenv("KEYSTORE_KEY_ALIAS") + keyPassword System.getenv("KEYSTORE_KEY_PASS") } } } @@ -34,7 +34,7 @@ android { minifyEnabled true shrinkResources true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - if (isTravis) signingConfig signingConfigs.release + if (isCi) signingConfig signingConfigs.release } } @@ -75,8 +75,8 @@ android { play { defaultToAppBundles.set(true) - enabled.set(isTravis) - serviceAccountCredentials.set(file("../.travis/secrets.json")) + enabled.set(isCi) + serviceAccountCredentials.set(file("../.github/secrets.json")) track.set("production") releaseStatus.set(com.github.triplet.gradle.androidpublisher.ReleaseStatus.DRAFT) } diff --git a/app/google-services.json b/app/google-services.json new file mode 100644 index 00000000..ebeac393 --- /dev/null +++ b/app/google-services.json @@ -0,0 +1,40 @@ +{ + "project_info": { + "project_number": "596428580538", + "firebase_url": "https://pretend-youre-xyzzy-android.firebaseio.com", + "project_id": "pretend-youre-xyzzy-android", + "storage_bucket": "pretend-youre-xyzzy-android.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:596428580538:android:5e4b3634c166b3102a0483", + "android_client_info": { + "package_name": "com.gianlu.pretendyourexyzzy" + } + }, + "oauth_client": [ + { + "client_id": "596428580538-idv220mduj2clinjoq11sd0n60dgbjr4.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyCkK6AXjBNjVHA7Pwqe_SixdSpfwJklWNE" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "596428580538-idv220mduj2clinjoq11sd0n60dgbjr4.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file