From 13151f34afecff0022e54bd4c668aa190ad8d97c Mon Sep 17 00:00:00 2001 From: Sean Wu Date: Sun, 8 Nov 2020 16:08:58 +0800 Subject: [PATCH] Build qa-release CD for Android. --- .github/workflows/build.yml | 2 + .github/workflows/qa-release.yml | 232 ++++++++++++++++++ .github/workflows/release.yml | 65 ----- CHANGELOG.md | 139 +++++++++++ README.md | 9 +- android/.idea/misc.xml | 2 +- .../app/src/main/assets/capacitor.config.json | 2 +- 7 files changed, 383 insertions(+), 68 deletions(-) create mode 100644 .github/workflows/qa-release.yml delete mode 100644 .github/workflows/release.yml create mode 100644 CHANGELOG.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3c177343..5aa2b08e4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/qa-release.yml b/.github/workflows/qa-release.yml new file mode 100644 index 000000000..4d56a8416 --- /dev/null +++ b/.github/workflows/qa-release.yml @@ -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 }} + + + APKs + + - + - + + 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/ \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 7297f65d4..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: release - -on: - push: - branches: - - develop - -jobs: - qa-release: - runs-on: ubuntu-latest - timeout-minutes: 10 - - steps: - - uses: actions/checkout@v2 - - - 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: Build Android APK - if: steps.version_check.outputs.changed == 'true' - run: | - npm install -g @angular/cli - npm install -g @ionic/cli - npm install - npm run build - npx cap sync - cd android/ - ./gradlew assembleDebug - cd .. - - - name: Create GitHub release - id: create_release - if: steps.version_check.outputs.changed == 'true' - 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: | - ![release!](https://i.giphy.com/media/lPulaaB9lDMnGZiivs/source.gif) - - # Changelog - - Release type: ${{ steps.version_check.outputs.type }} - prerelease: true - - - name: Upload APKs to release assets - if: steps.version_check.outputs.changed == 'true' - 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 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 000000000..ff5ab9c7f --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,139 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## 0.6.0 - 2020-11-08 + +### Added + +- Build capture wall. #141 +- Build pages for contact selection and sending PostCapture. #143, #147 +- Configure the CD with GitHub Action to deploy Android release to Google Play Console on QA release. #144 + +### Changed + +#### Code Quality + +- Remove unnecessary `header.component`. #151 +- Merge the `internal` branch into `develop`. From now on, we only maintain the develop branch with secrets environment variables to access storage backend. +- Improve the architecture for router guards. + +#### UI/UX + +- Rebuild most pages with `@angular/material` library, including: #160 + - rebuild `storage.page` with PostCapture tab + - rebuild `about.page` + - add `profile.page` + - add `privacy.page` + - rebuild `settings.page` + - rebuild `proof.page` + - rebuild `information.page` #142 + - rebuild `signup.page` + - rebuild `login.page` +- Remove unnecessary abstraction in UI: + - multiple publishers on `settings.page` + - multiple information providers on `information.page` + - multiple signatures on `information.page` +- Update Ionic color theme to be consistent with design and `@angular/material`. + +### Fixed + +- Cascadingly remove proof thumb. #149 +- Fix `this.router.navigate.(['..'])` not working bug. + +## 0.5.1 - 2020-10-14 + +### Fixed + +- Add missing zh-TW translations. + +## 0.5.0 - 2020-10-13 + +### Added + +- Add zh-Tw language support. +- Add login and signup pages. + + +## 0.4.1 - 2020-09-24 + +### Fixed + +- Revert the accidentally overridden drawer menu. + +## 0.4.0 - 2020-09-23 + +### Added + +- Add settings and drawer. #97 +- Group photos by date. #95 +- Add ALL/TAG view modes on the storge page. +- Add iOS platform support. + +## 0.3.0 - 2020-09-07 + +### Changed + +#### Code Quality + +- Improve storage performance. #85 + +### Fixed + +- Fix the app does not catch the image from external camera app when the available memory is low on Android. #83 + +## 0.2.0 - 2020-08-19 + +### Added + +- Display version on the settings page. #20 +- Implement the preferences for CapacitorProvider. #24 +- Implement numbers-storage publisher. [internal] #28 #25 +- Add launcher icon and splash screen. #22 + +### Changed + +#### API + +- Use PKCS#8 and SubjectPublicKeyInfo format in ECDSA signatures. +- Change the format of SortedProofInformation to be the same as Starling Capture. + +#### UI/UX + +- Make the proof deletion a blocking action. + +#### Code Quality + +- Enable TypeScript strict checks. #19 +- Replace ngx-translate with transloco library. #18 +- Update dependencies and enable dependabot. #30 +- Enable Codacy with coverage. #41 + +### Fixed + +- Fix race conditions caused by Promise is eagerly created in switchMapTo(), concatMapTo(), or mergeMapTo() by wrapping the promise with defer(). + +## 0.1.0 - 2020-07-27 + +This is the first release! _Capture Lite_ is a cross-platform app adapted from [Starling Capture app](https://github.com/numbersprotocol/starling-capture). + +### Added + +#### Components + +- Media Source + - Picture captured from the internal camera +- Information Provider + - Capacitor built-in `Device` and `Geolocation` plugins +- Signature Provider + - Web Crypto API +- Publisher + - Sample publisher - a sample publisher does nothing + +#### Supported Platforms + +- Web - see the demo [here](https://github.com/numbersprotocol/capture-lite#demo-app) +- Android - the APK file `app-debug.apk` is attached to this release \ No newline at end of file diff --git a/README.md b/README.md index ab03da839..017f33a37 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,14 @@ android { } ``` -When push to the `develop` branch with new version in the `package.json` file, GitHub Action would automatically create new release. +__Remember to write the changelog in `CHANGELOG.md`.__ + +When push to the `develop` branch with new version in the `package.json` file, GitHub Action would automatically do the following jobs: + +1. Create release GitHub page with debug APK. +1. Publish the app to Play Console on alpha track. +1. Upload debug apk to Google Drive. +1. Send notification to the private `reminder-releases` slack channel. ### Deploy diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml index fdae1d0dc..d5d35ec44 100644 --- a/android/.idea/misc.xml +++ b/android/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/android/app/src/main/assets/capacitor.config.json b/android/app/src/main/assets/capacitor.config.json index 376f0d671..21a459c6d 100644 --- a/android/app/src/main/assets/capacitor.config.json +++ b/android/app/src/main/assets/capacitor.config.json @@ -12,4 +12,4 @@ }, "cordova": {}, "linuxAndroidStudioPath": "/home/username/android-studio/bin/studio.sh" -} +} \ No newline at end of file