Skip to content

Commit

Permalink
Merge pull request #208 from lihenggui/modularization
Browse files Browse the repository at this point in the history
Update CI to do the auto signing
  • Loading branch information
lihenggui authored Jun 30, 2023
2 parents 84e3dd6 + 51ca65e commit d851628
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 2 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/Build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ jobs:
- name: Copy CI gradle.properties
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties

- name: Write sign info
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'lihenggui/Blocker'
run: |
if [ ! -z "${{ secrets.KEYSTORE }}" ]; then
echo releaseStorePassword='${{ secrets.SIGNING_STORE_PASSWORD }}' >> gradle.properties
echo releaseKeyAlias='${{ secrets.SIGNING_KEY_ALIAS }}' >> gradle.properties
echo releaseKeyPassword='${{ secrets.SIGNING_KEY_PASSWORD }}' >> gradle.properties
echo releaseStoreFile='${{ github.workspace }}/key.jks' >> gradle.properties
echo ${{ secrets.KEYSTORE }} | base64 --decode > ${{ github.workspace }}/key.jks
fi
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
Expand All @@ -48,6 +59,42 @@ jobs:
name: APKs
path: '**/build/outputs/apk/**/*.apk'

- name: Upload built Foss apk
if: success() && github.event_name != 'pull_request' && github.repository == 'lihenggui/Blocker'
uses: actions/upload-artifact@v3
with:
name: Foss
path: ${{ github.workspace }}/app/build/outputs/apk/foss/release

- name: Upload built Market apk
if: success() && github.event_name != 'pull_request' && github.repository == 'lihenggui/Blocker'
uses: actions/upload-artifact@v3
with:
name: Market
path: ${{ github.workspace }}/app/build/outputs/apk/market/release

- name: Upload mappings
if: success() && github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v3
with:
name: mappings
path: "app-compose/build/outputs/mapping/marketRelease"

- name: Set apk path
id: apk-path
run: |
foss_path=$(find **/build/outputs/apk/foss -name '*.apk' -type f | head -1)
echo "foss_path=$foss_path" >> $GITHUB_OUTPUT
market_path=$(find **/build/outputs/apk/market -name '*.apk' -type f | head -1)
echo "market_path=$market_path" >> $GITHUB_OUTPUT
- name: Get apk info
if: success() && github.event_name != 'pull_request' && github.repository == 'lihenggui/Blocker'
id: apk-info
uses: zhaobozhen/apk-info-action@1.1.2
with:
apk-path: ${{ steps.apk-path.outputs.foss_path }}

- name: Run local tests
run: ./gradlew testfossDebug testMarketDebug

Expand Down
12 changes: 10 additions & 2 deletions app-compose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,16 @@ android {

// To publish on the Play store a private signing key is required, but to allow anyone
// who clones the code to sign and run the release variant, use the debug signing key.
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
signingConfig = signingConfigs.getByName("debug")
signingConfig = if (project.hasProperty("releaseStoreFile")) {
signingConfigs.create("release") {
storeFile = File(project.properties["releaseStoreFile"] as String)
storePassword = project.properties["releaseStorePassword"] as String
keyAlias = project.properties["releaseKeyAlias"] as String
keyPassword = project.properties["releaseKeyPassword"] as String
}
} else {
signingConfigs.getByName("debug")
}
}
create("benchmark") {
// Enable all the optimizations from release build through initWith(release).
Expand Down

0 comments on commit d851628

Please sign in to comment.