Skip to content

Commit

Permalink
Update workflows and signing
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPushkin committed Sep 23, 2022
1 parent 4545fdc commit d08397c
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 41 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/assemble.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Assemble

on:
push:
branches: [ "master" ]
workflow_dispatch:

env:
keystore_password: ${{ secrets.KeystorePassword }}
keystore_alias: ${{ secrets.KeystoreAlias }}
keystore_alias_password: ${{ secrets.KeystoreAliasPassword }}

jobs:
assemble-release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'

- name: Decrypt keystore file
run: |
gpg --quiet --batch --yes --decrypt \
--passphrase="${{ secrets.KeystoreEncKey }}" \
--output release.jks \
opencamera-sensors.jks.gpg
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Assemble release
run: ./gradlew assembleRelease

- name: Upload release APK
uses: actions/upload-artifact@v3
with:
name: release-apk
path: app/build/outputs/apk/release/app-release.apk
if-no-files-found: error
41 changes: 12 additions & 29 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,26 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-java@v2
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'

- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
distribution: 'temurin'
java-version: '11'
cache: 'gradle'

- name: Decrypt keystore file
env:
enc_key: ${{ secrets.KeystoreEncKey }}
run: gpg --quiet --batch --yes --decrypt --passphrase="$enc_key" --output my-release-key.keystore my-release-key.keystore.gpg

- name: Assemble debug
run: ./gradlew assembleDebug
run: |
gpg --quiet --batch --yes --decrypt \
--passphrase="${{ secrets.KeystoreEncKey }}" \
--output release.jks \
opencamera-sensors.jks.gpg
- name: Assemble release
run: ./gradlew assembleRelease
- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Test debug
run: ./gradlew testDebugUnitTest

- name: Test release
run: ./gradlew testReleaseUnitTest

- name: Cleanup Gradle Cache
# Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
# Restoring these files from a GitHub Actions cache might cause problems for future builds.
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
13 changes: 1 addition & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,9 @@ android {

signingConfigs {
release
debug
if (System.getenv("CI")) {
release {
storeFile rootProject.file("my-release-key.keystore")
storePassword System.getenv("keystore_password")
keyAlias System.getenv("keystore_alias")
keyPassword System.getenv("keystore_alias_password")
}
debug {
storeFile rootProject.file("my-release-key.keystore")
storeFile rootProject.file("release.jks")
storePassword System.getenv("keystore_password")
keyAlias System.getenv("keystore_alias")
keyPassword System.getenv("keystore_alias_password")
Expand All @@ -48,10 +41,6 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
signingConfig signingConfigs.debug
}
}

lintOptions {
Expand Down
Binary file removed my-release-key.keystore.gpg
Binary file not shown.
Binary file removed opencamera-extended-0152130a4960.json.enc
Binary file not shown.
Binary file added opencamera-sensors.jks.gpg
Binary file not shown.

0 comments on commit d08397c

Please sign in to comment.