Skip to content
Permalink
Browse files

Push tagged releases to GitHub releases

  • Loading branch information...
chrisbanes committed Aug 15, 2019
1 parent ba60289 commit 243104954382aeb8229548311f47bb610e27a51c
@@ -48,12 +48,12 @@ persist_workspace: &persist_workspace
decrypt_secrets: &decrypt_secrets
run:
name: Decrypt secrets
command: signing/setup.sh $ENCRYPT_KEY
command: release/signing-setup.sh $ENCRYPT_KEY

clean_secrets: &clean_secrets
run:
name: Cleanup secrets
command: signing/cleanup.sh
command: release/signing-cleanup.sh

jobs:
build_debug:
@@ -140,21 +140,55 @@ jobs:
command: ./gradlew publishRelease -Ptivi.versioncode=$CIRCLE_BUILD_NUM
- <<: *clean_secrets

deploy_to_github_release:
docker:
- image: circleci/golang:1.12
working_directory: *workspace
steps:
- checkout
- <<: *attach_workspace
- run:
name: "Install ghr"
command: go get github.com/tcnksm/ghr
- run:
name: "Publish Release on GitHub"
command: release/tag-github-release.sh

workflows:
version: 2
build_test_deploy:
jobs:
- build_debug
- build_debug:
filters:
tags:
only: /.*/
- build_release:
requires:
- build_debug
filters:
tags:
only: /.*/
- check:
requires:
- build_debug
filters:
tags:
only: /.*/
- deploy_to_play:
requires:
- check
- build_release
filters:
branches:
only: master
tags:
only: /.*/
- deploy_to_github_release:
requires:
- check
- build_release
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
@@ -10,10 +10,10 @@ build/
captures
.externalNativeBuild

# Do not commit plain release keys
signing/app-release.jks
signing/play-account.p12
signing/play-account.json
# Do not commit plain-text release keys
app-release.jks
play-account.p12
play-account.json

# Do not commit firebase config
google-services.json
@@ -46,7 +46,7 @@ apply plugin: 'com.github.triplet.play'
play {
track = 'internal'
defaultToAppBundles = true
serviceAccountCredentials = rootProject.file('signing/play-account.json')
serviceAccountCredentials = rootProject.file('release/play-account.json')
}

apply plugin: 'com.google.android.gms.oss-licenses-plugin'
@@ -56,7 +56,7 @@ apply plugin: "androidx.navigation.safeargs.kotlin"
def appVersionCode = propOrDef("tivi.versioncode", 17) as Integer
println("APK version code: " + appVersionCode)

def useReleaseKeystore = rootProject.file("signing/app-release.jks").exists()
def useReleaseKeystore = rootProject.file("release/app-release.jks").exists()

android {
compileSdkVersion buildConfig.compileSdk
@@ -80,15 +80,15 @@ android {

signingConfigs {
debug {
storeFile rootProject.file("signing/app-debug.jks")
storeFile rootProject.file("release/app-debug.jks")
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}

release {
if (useReleaseKeystore) {
storeFile rootProject.file("signing/app-release.jks")
storeFile rootProject.file("release/app-release.jks")
storePassword propOrDef('TIVI_RELEASE_KEYSTORE_PWD', "")
keyAlias "tivi"
keyPassword propOrDef('TIVI_RELEASE_KEY_PWD', "")
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file not shown.
@@ -0,0 +1,7 @@
#!/bin/bash

# Delete Release key
rm -f release/app-release.jks

# Delete Play Store key
rm -f release/play-account.json
@@ -0,0 +1,16 @@
#!/bin/bash

ENCRYPT_KEY=$1

if [[ ! -z "$ENCRYPT_KEY" ]]; then
# Decrypt Release key
openssl aes-256-cbc -md sha256 -d -in release/app-release.aes -out release/app-release.jks -k ${ENCRYPT_KEY}

# Decrypt Play Store key
openssl aes-256-cbc -md sha256 -d -in release/play-account.aes -out release/play-account.json -k ${ENCRYPT_KEY}

# Decrypt Google Services key
openssl aes-256-cbc -md sha256 -d -in release/google-services.aes -out app/google-services.json -k ${ENCRYPT_KEY}
else
echo "ENCRYPT_KEY is empty"
fi
@@ -0,0 +1,20 @@
#!/bin/bash

if [[ -z "$CIRCLE_TAG" ]]; then
echo "Tag name is empty"
exit 1
fi

ARTIFACTS_FOLDER="/tmp/tivi-artifacts-$CIRCLE_BUILD_NUM"

mkdir -p ${ARTIFACTS_FOLDER}
cp app/build/outputs/apk/release/app-release.apk ${ARTIFACTS_FOLDER}/tivi-release.apk
cp app/build/outputs/apk/debug/app-debug.apk ${ARTIFACTS_FOLDER}/tivi-debug.apk

ghr -t ${GITHUB_TOKEN} \
-u ${CIRCLE_PROJECT_USERNAME} \
-r ${CIRCLE_PROJECT_REPONAME} \
-c ${CIRCLE_SHA1} \
-delete \
${CIRCLE_TAG} \
${ARTIFACTS_FOLDER}

This file was deleted.

Binary file not shown.

This file was deleted.

0 comments on commit 2431049

Please sign in to comment.
You can’t perform that action at this time.