Skip to content

Commit

Permalink
ci: build apk for direct download (#10)
Browse files Browse the repository at this point in the history
* build: change signing keystore file name

* ci: update to play store specfic env vars for the publish workflow

* ci: build and sign release apk on release
  • Loading branch information
kieranroneill authored Oct 15, 2024
1 parent 2cd4b21 commit d3e601f
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 25 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ on:
required: true
type: string
secrets:
ANDROID_KEY_ALIAS:
PLAY_STORE_UPLOAD_KEY_ALIAS:
required: true
ANDROID_KEY_PASSWORD:
PLAY_STORE_UPLOAD_KEY_PASSWORD:
required: true
ANDROID_KEYSTORE:
PLAY_STORE_UPLOAD_KEYSTORE:
required: true
ANDROID_KEYSTORE_PASSWORD:
PLAY_STORE_UPLOAD_KEYSTORE_PASSWORD:
required: true
GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY:
required: true
Expand All @@ -32,10 +32,10 @@ jobs:
uses: ./.github/actions/use-ruby-dependencies
- name: "🔑 Create Android Signing Keys"
env:
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.PLAY_STORE_UPLOAD_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.PLAY_STORE_UPLOAD_KEY_PASSWORD }}
ANDROID_KEYSTORE: ${{ secrets.PLAY_STORE_UPLOAD_KEYSTORE }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.PLAY_STORE_UPLOAD_KEYSTORE_PASSWORD }}
run: ./scripts/create_android_signing_keys.sh
- name: "🔑 Create Play Store Credentials"
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/publish_beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
with:
environment: "beta"
secrets:
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
PLAY_STORE_UPLOAD_KEY_ALIAS: ${{ secrets.PLAY_STORE_UPLOAD_KEY_ALIAS }}
PLAY_STORE_UPLOAD_KEY_PASSWORD: ${{ secrets.PLAY_STORE_UPLOAD_KEY_PASSWORD }}
PLAY_STORE_UPLOAD_KEYSTORE: ${{ secrets.PLAY_STORE_UPLOAD_KEYSTORE }}
PLAY_STORE_UPLOAD_KEYSTORE_PASSWORD: ${{ secrets.PLAY_STORE_UPLOAD_KEYSTORE_PASSWORD }}
GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY }}
7 changes: 4 additions & 3 deletions .github/workflows/publish_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ jobs:
with:
environment: "production"
secrets:
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
PLAY_STORE_UPLOAD_KEY_ALIAS: ${{ secrets.PLAY_STORE_UPLOAD_KEY_ALIAS }}
PLAY_STORE_UPLOAD_KEY_PASSWORD: ${{ secrets.PLAY_STORE_UPLOAD_KEY_PASSWORD }}
PLAY_STORE_UPLOAD_KEYSTORE: ${{ secrets.PLAY_STORE_UPLOAD_KEYSTORE }}
PLAY_STORE_UPLOAD_KEYSTORE_PASSWORD: ${{ secrets.PLAY_STORE_UPLOAD_KEYSTORE_PASSWORD }}
GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_KEY }}
4 changes: 2 additions & 2 deletions .github/workflows/pull_request_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:

build_android:
name: "Build Android"
needs: [validate_pr_title]
needs: [install, validate_pr_title]
runs-on: ubuntu-latest
environment: development
steps:
Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:

tests:
name: "Tests"
needs: [validate_pr_title]
needs: [install, validate_pr_title]
runs-on: ubuntu-latest
environment: development
steps:
Expand Down
26 changes: 24 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,20 @@ on:
required: true
type: string
secrets:
WRITE_REPOS_TOKEN:
APK_SIGNING_KEY_ALIAS:
required: true
APK_SIGNING_KEY_PASSWORD:
required: true
APK_SIGNING_KEYSTORE:
required: true
APK_SIGNING_KEYSTORE_PASSWORD:
required: true

permissions:
contents: write # to be able to publish a github release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests

jobs:
release:
name: "Release"
Expand All @@ -22,8 +33,19 @@ jobs:
steps:
- name: "🛎 Checkout"
uses: actions/checkout@v4
- name: "📱 Setup Flutter"
uses: ./.github/actions/use-flutter-dependencies
- name: "📦 Install yq"
uses: ./.github/actions/install-yq # needed to update pubspec.yaml via a shell command
- name: "🔑 Create Android Signing Keys"
env:
ANDROID_KEY_ALIAS: ${{ secrets.APK_SIGNING_KEY_ALIAS }}
ANDROID_KEY_PASSWORD: ${{ secrets.APK_SIGNING_KEY_PASSWORD }}
ANDROID_KEYSTORE: ${{ secrets.APK_SIGNING_KEYSTORE }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.APK_SIGNING_KEYSTORE_PASSWORD }}
run: ./scripts/create_android_signing_keys.sh
- name: "🏗️ Build Android APK"
run: flutter build apk --release
- name: "🔧 Setup Node"
uses: actions/setup-node@v4
with:
Expand All @@ -39,5 +61,5 @@ jobs:
GIT_COMMITTER_NAME: agoralabs-bot
GIT_COMMITTER_EMAIL: tech@agoralabs.sh
# used to push the release commit and create the tags
GITHUB_TOKEN: ${{ secrets.WRITE_REPOS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn semantic-release
10 changes: 9 additions & 1 deletion .github/workflows/release_beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ on:
branches:
- beta

permissions:
contents: write # to be able to publish a github release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests

jobs:
deploy:
name: "🔖 Release"
uses: ./.github/workflows/release.yml
with:
environment: "beta"
secrets:
WRITE_REPOS_TOKEN: ${{ secrets.WRITE_REPOS_TOKEN }}
APK_SIGNING_KEY_ALIAS: ${{ secrets.APK_SIGNING_KEY_ALIAS }}
APK_SIGNING_KEY_PASSWORD: ${{ secrets.APK_SIGNING_KEY_PASSWORD }}
APK_SIGNING_KEYSTORE: ${{ secrets.APK_SIGNING_KEYSTORE }}
APK_SIGNING_KEYSTORE_PASSWORD: ${{ secrets.APK_SIGNING_KEYSTORE_PASSWORD }}
10 changes: 9 additions & 1 deletion .github/workflows/release_production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ on:
branches:
- main

permissions:
contents: write # to be able to publish a github release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests

jobs:
deploy:
name: "🔖 Release"
uses: ./.github/workflows/release.yml
with:
environment: "production"
secrets:
WRITE_REPOS_TOKEN: ${{ secrets.WRITE_REPOS_TOKEN }}
APK_SIGNING_KEY_ALIAS: ${{ secrets.APK_SIGNING_KEY_ALIAS }}
APK_SIGNING_KEY_PASSWORD: ${{ secrets.APK_SIGNING_KEY_PASSWORD }}
APK_SIGNING_KEYSTORE: ${{ secrets.APK_SIGNING_KEYSTORE }}
APK_SIGNING_KEYSTORE_PASSWORD: ${{ secrets.APK_SIGNING_KEYSTORE_PASSWORD }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ fabric.properties
/android/app/debug
/android/app/profile
/android/app/release
upload_keystore.jks
signing_keystore.jks
android/secure.properties

### Fastlane
Expand Down
3 changes: 3 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
[
"@semantic-release/github",
{
"assets": [
{ "label": "kibisis_release.apk" ,"path": "build/app/outputs/flutter-apk/release/app-release.apk" }
],
"releasedLabels": ["🚀 released"]
}
]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ See the [Flutter CLI](https://docs.flutter.dev/reference/flutter-cli#flutter-com

### 6.2. Create An Upload Keystore

The command below can be used to generate an upload keystore used for app (upload) signing:
The command below can be used to generate a keystore used for app signing:

```shell
keytool -genkeypair \
Expand Down
4 changes: 2 additions & 2 deletions scripts/create_android_signing_keys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ function main {

# decode the base64-encoded keystore and write it to a .jks file at the project root
printf "%b decoding the base64-encoded key store to the keystore file... \n" "${INFO_PREFIX}"
echo "${ANDROID_KEYSTORE}" | base64 -d > "upload_keystore.jks"
echo "${ANDROID_KEYSTORE}" | base64 -d > "signing_keystore.jks"

# generate key.properties
printf "%b creating key.properties file... \n" "${INFO_PREFIX}"
{
echo "keyAlias=${ANDROID_KEY_ALIAS}"
echo "keyPassword=${ANDROID_KEY_PASSWORD}"
echo "storeFile=${PWD}/upload_keystore.jks"
echo "storeFile=${PWD}/signing_keystore.jks"
echo "storePassword=${ANDROID_KEYSTORE_PASSWORD}"
} > "android/key.properties"

Expand Down

0 comments on commit d3e601f

Please sign in to comment.