Skip to content

Commit

Permalink
Build qa-release CD for Android.
Browse files Browse the repository at this point in the history
  • Loading branch information
seanwu1105 committed Nov 8, 2020
1 parent abf3ff3 commit 13151f3
Show file tree
Hide file tree
Showing 7 changed files with 383 additions and 68 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ jobs:
coverage-reports: ./coverage/cobertura-coverage.xml

- name: Build Ionic
env:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
run: npm run build

- name: Build Android
Expand Down
232 changes: 232 additions & 0 deletions .github/workflows/qa-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
name: qa-release

on:
push:
branches:
- develop

jobs:
github-release:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- uses: actions/checkout@v2

- name: Extract branch name
id: extract_branch
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"

- uses: actions/setup-node@v1
with:
node-version: 10

- name: Check if version has been updated
id: version_check
uses: EndBug/version-check@v1
with:
diff-search: true
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up JDK
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Build Ionic
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
env:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
run: |
npm install -g @angular/cli
npm install -g @ionic/cli
npm install
npm run test-ci
npm run build
- name: Build Android debug APK
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
run: |
npx cap sync android
cd android/
./gradlew assembleDebug
- name: Create GitHub prerelease
id: create_release
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version_check.outputs.version }}
release_name: ${{ steps.version_check.outputs.version }}
body: Thanks for following along! For more information check out the [CHANGELOG](https://github.com/numbersprotocol/capture-lite/blob/develop/CHANGELOG.md).
prerelease: true

- name: Upload debug APK to release assets
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./android/app/build/outputs/apk/debug/app-debug.apk
asset_name: app-debug.apk
asset_content_type: application/vnd.android.package-archive

- name: Upload debug metadata.json to release assets
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./android/app/build/outputs/apk/debug/output-metadata.json
asset_name: output-metadata-debug.json
asset_content_type: application/json

- name: Send Slack notification
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
uses: rtCamp/action-slack-notify@master
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: reminder-releases
SLACK_COLOR: '#6EE4D3'
SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png
SLACK_MESSAGE: |
Version: ${{ steps.version_check.outputs.version }}
<https://github.com/numbersprotocol/capture-lite/releases/tag/${{ steps.version_check.outputs.version }}|GitHub Release Note>
APKs
- <https://drive.google.com/drive/folders/1NH-4mruBBubxHMfXF6VXaKRCQ76Ldg_n?usp=sharing|Google Drive (debug)>
- <https://play.google.com/apps/testing/io.numbersprotocol.capturelite|Google Play Closed Alpha Testing (release)>
Notes
- Publishing process usually requires some time to complete, and thus the link provided above might still display the old version of the app. Please check the app version before download and install the app.
- This message is automatically sent from GitHub Action.
SLACK_TITLE: Capture Lite QA Release
SLACK_USERNAME: GitHub Action

android-google-play-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Extract branch name
id: extract_branch
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"

- uses: actions/setup-node@v1
with:
node-version: 10

- name: Check if version has been updated
id: version_check
uses: EndBug/version-check@v1
with:
diff-search: true
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up JDK
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Build Ionic
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
env:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
run: |
npm install -g @angular/cli
npm install -g @ionic/cli
npm install
npm run test-ci
npm run build
- name: Build Android release bundle (AAB)
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
run: |
npx cap sync android
cd android/
./gradlew bundleRelease
- name: Sign release AAB
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
uses: r0adkll/sign-android-release@v1
with:
releaseDirectory: ./android/app/build/outputs/bundle/release
signingKeyBase64: ${{ secrets.ANDROID_KEYSTORE_FILE }}
alias: ${{ secrets.ANDROID_KEY_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}

- name: Create service_account.json
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
run: echo '${{ secrets.PLAY_CONSOLE_SERVICE_ACCOUNT_JSON }}' > service_account.json

- name: Deploy to Play Store (closed alpha track)
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: service_account.json
packageName: io.numbersprotocol.capturelite
releaseFile: ./android/app/build/outputs/bundle/release/app-release.aab
track: alpha

android-google-drive-upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Extract branch name
id: extract_branch
run: echo "::set-output name=branch::${GITHUB_REF#refs/heads/}"

- uses: actions/setup-node@v1
with:
node-version: 10

- name: Check if version has been updated
id: version_check
uses: EndBug/version-check@v1
with:
diff-search: true
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up JDK
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Build Ionic
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
env:
NUMBERS_STORAGE_BASE_URL: ${{ secrets.NUMBERS_STORAGE_BASE_URL }}
run: |
npm install -g @angular/cli
npm install -g @ionic/cli
npm install
npm run test-ci
npm run build
- name: Build APKs
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
run: |
npx cap sync android
cd android/
./gradlew assembleDebug
- name: Upload debug outputs to Google Drive
if: steps.version_check.outputs.changed == 'true' && steps.extract_branch.outputs.branch == 'develop'
uses: satackey/action-google-drive@v1
with:
skicka-tokencache-json: ${{ secrets.SKICKA_TOKENCACHE_JSON }}
google-client-id: ${{ secrets.SKICKA_GOOGLE_CLIENT_ID }}
google-client-secret: ${{ secrets.SKICKA_GOOGLE_CLIENT_SECRET }}
upload-from: ./android/app/build/outputs/apk/debug/
upload-to: /capture-lite/apk/debug/
65 changes: 0 additions & 65 deletions .github/workflows/release.yml

This file was deleted.

Loading

0 comments on commit 13151f3

Please sign in to comment.