Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up Android Production deployment #1244

Merged
merged 3 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 36 additions & 33 deletions .github/workflows/fieldmark-google-play-prod.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

name: Deploy to Google Play For Prod deploy
name: Deploy to Google Play For Production

on:
workflow_dispatch:
Expand All @@ -8,21 +8,20 @@ jobs:
node-deb-gh-build-play:
runs-on: ubuntu-latest
continue-on-error: true
env:
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
strategy:
matrix:
node-version: ['20']
outputs:
prnum: ${{ steps.prnum.outputs.value }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache node modules
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
Expand All @@ -43,21 +42,32 @@ jobs:
else
echo "TURBO_TEAM and/or TURBO_TOKEN not set. Remote caching may not be available."
fi
- name: Install jq
run: sudo apt-get install -y jq
- name: Declare some variables
shell: bash
run: |
echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
echo "app_version=$(jq -r '.version' app/package.json)" >> "$GITHUB_ENV"
- name: Create version string
shell: bash
run: |
echo "version_string=v${{env.app_version}}-android-#${{env.sha_short}}" >> "$GITHUB_ENV"
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-java-with-gradle
- name: Cache Gradle packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-java-with-gradle
- name: Set up adopt JDK 1.17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
Expand All @@ -68,18 +78,7 @@ jobs:
with:
ruby-version: 3.3.1
bundler-cache: true
working-directory: android
# We'll do this when we have android-specific tests...
# - name: Run tests
# run: |
# cd android
# bundle exec fastlane android test
# echo -n "::set-output name=value::$(git log --perl-regexp --pretty='%s' | grep 'Merge #' | head -n1 | cut -d'#' -f2)-$(git describe --long 2>/dev/null || git describe --all --long --always)"
- name: Get PR Number
id: prnum
run: |
echo -n "value=$(bin/getDescribeString.sh gh-play)" >> "$GITHUB_OUTPUT"
shell: bash
working-directory: app/android
- name: Decode Service Account Key JSON File
uses: timheuer/base64-to-file@v1
id: service_account_json_file
Expand All @@ -94,39 +93,43 @@ jobs:
encodedString: ${{ secrets.KEYSTORE_FILE }}
# https://github.com/android-actions/setup-android
- name: Setup Android SDK
uses: android-actions/setup-android@v2
uses: android-actions/setup-android@v3
- name: Building webapp
run: |
export platform="github-actions-play"
export serverprefix="fieldmark"
export VITE_CLUSTER_ADMIN_GROUP_NAME=cluster-admin
export VITE_COMMIT_VERSION=$(bin/getDescribeString.sh android)
export VITE_COMMIT_VERSION=${{env.version_string}}
export VITE_SHOW_WIPE=true
export VITE_SHOW_MINIFAUXTON=false
export VITE_DIRECTORY_HOST=${{vars.PRODUCTION_CONDUCTOR_URL}}
export VITE_DIRECTORY_PORT=443
export VITE_PRODUCTION_BUILD=true
export VITE_PROD_BUILD=true
export VITE_TAG=prodAndroid
export VITE_CONDUCTOR_URL=${{vars.NIGHTLY_CONDUCTOR_URL}}
export VITE_TAG=prodAndroid
export VITE_NOTEBOOK_LIST_TYPE=${{vars.NOTEBOOK_LIST_TYPE}}
export VITE_NOTEBOOK_NAME=${{vars.NOTEBOOK_NAME}}
export VITE_THEME=${{vars.THEME}}
export VITE_BUGSNAG_KEY=${{secrets.BUGSNAG_KEY}}
export VITE_APP_ID=${{vars.APP_ID}}
export VITE_APP_NAME="${{vars.APP_NAME}}"
export VITE_SHOW_RECORD_SUMMARY_COUNTS="${{vars.VITE_SHOW_RECORD_SUMMARY_COUNTS}}"
npm ci
npm run build
# https://capacitorjs.com/docs/android
# The bundle install shouldn't be necessary, but given we've got ios and android in...
- run: npx cap update android
- run: npx cap sync --deployment android
- run: npm run app-update android --workspace=@faims3/app
- run: npm run webapp-sync --workspace=@faims3/app -- --deployment android
- name: Fastlane
run: |
cd android
cd app/android
bundle install
bundle exec fastlane deploy_fieldmark
env:
APP_ID: ${{ vars.APP_ID }}
ANDROID_RELEASE_STATUS: ${{ vars.ANDROID_RELEASE_STATUS }}
ANDROID_DEPLOY_TRACK: "production"
JAVA_KEYSTORE: ${{ steps.android_keystore.outputs.filePath }}
JAVA_KEYSTORE_PASSWORD: ${{ secrets.JAVA_KEYSTORE_PASSWORD }}
JAVA_KEY: ${{ secrets.JAVA_KEY}}
JAVA_KEY_PASSWORD: ${{ secrets.JAVA_KEY_PASSWORD }}
ANDROID_JSON_KEY_FILE: ${{ steps.service_account_json_file.outputs.filePath }}
serverprefix: "fieldmark"
prnum: ${{steps.prnum.outputs.value}}
prnum: ${{env.version_string}}
2 changes: 0 additions & 2 deletions .github/workflows/nightly-android-testbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ jobs:
export VITE_SHOW_WIPE=true
export VITE_SHOW_MINIFAUXTON=true
export VITE_CONDUCTOR_URL=${{vars.NIGHTLY_CONDUCTOR_URL}}
export VITE_PRODUCTION_BUILD=true
export VITE_PROD_BUILD=true
export VITE_TAG=prodAndroid
export VITE_NOTEBOOK_LIST_TYPE=${{vars.NOTEBOOK_LIST_TYPE}}
export VITE_NOTEBOOK_NAME=${{vars.NOTEBOOK_NAME}}
Expand Down
2 changes: 0 additions & 2 deletions app/.env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ VITE_POUCH_BATCH_SIZE=1000
VITE_BUGSNAG_KEY=<your bugsnag API key>
# Set to true to enable some debugging messaging
VITE_DEBUG_APP=true
# Set to true for a production build with VITE
VITE_PRODUCTION_BUILD=false
# Set to true for verbose debug messages from PouchDB
VITE_POUCHDB_DEBUG=false
# The theme to use for the app, 'default' or 'bubble' or 'bssTheme'
Expand Down
4 changes: 1 addition & 3 deletions app/.github/workflows/appstore-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ jobs:
export VITE_SHOW_WIPE=true
export VITE_SHOW_MINIFAUXTON=false
export VITE_DIRECTORY_HOST=db.fieldmark.app
export VITE_DIRECTORY_PORT=443
export VITE_PRODUCTION_BUILD=true
export VITE_PROD_BUILD=true
export VITE_DIRECTORY_PORT=443
export VITE_TAG=prodIOS
export VITE_BUGSNAG_KEY=${{secrets.BUGSNAG_KEY}}
git clean -xfd
Expand Down
4 changes: 1 addition & 3 deletions app/.github/workflows/appstore-testflight.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ jobs:
export VITE_SHOW_WIPE=true
export VITE_SHOW_MINIFAUXTON=false
export VITE_DIRECTORY_HOST=db.testing.fieldmark.app
export VITE_DIRECTORY_PORT=443
export VITE_PRODUCTION_BUILD=true
export VITE_PROD_BUILD=true
export VITE_DIRECTORY_PORT=443
export VITE_TAG=prodIOS
export VITE_BUGSNAG_KEY=${{secrets.BUGSNAG_KEY}}
git clean -xfd
Expand Down
1 change: 0 additions & 1 deletion infrastructure/aws-cdk/lib/components/front-end.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ export class FaimsFrontEnd extends Construct {
VITE_SHOW_RECORD_SUMMARY_COUNTS: 'true',
// Conductor API URL
VITE_CONDUCTOR_URL: props.conductorUrl,
VITE_PRODUCTION_BUILD: 'true',
VITE_TAG: 'CDKDeployment',
};

Expand Down