Skip to content

Deploy the Android app to github artifacts #1

Deploy the Android app to github artifacts

Deploy the Android app to github artifacts #1

name: Deploy the Android app to github artifacts
on:
workflow_dispatch:
inputs:
version:
description: Build version (eg 0.30.0)
required: true
build-number:
description: Build number
required: true
message:
description: Change logs
required: false
jobs:
build:
runs-on: [self-hosted]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: "17"
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.24.0"
channel: stable
- name: Set env
run: |
echo "FLUTTER_VERSION_NAME=${{ github.event.inputs.version }}" >> $GITHUB_ENV
echo "FLUTTER_VERSION_CODE=${{ github.event.inputs.build-number }}" >> $GITHUB_ENV
echo "BRANCH_KEY=${{ secrets.BRANCH_KEY }}" >> $GITHUB_ENV
echo "BRANCH_KEY_TEST=${{ secrets.BRANCH_KEY_TEST }}" >> $GITHUB_ENV
echo "SIGNATURE_HASH=${{ secrets.SIGNATURE_HASH }}" >> $GITHUB_ENV
echo "SIGNATURE_HASH_INHOUSE=${{ secrets.SIGNATURE_HASH_INHOUSE }}" >> $GITHUB_ENV
echo NAME_SUFFIX=main-${{ github.event.inputs.build-number }} >> $GITHUB_ENV
- uses: webfactory/[email protected]
with:
ssh-private-key: |
${{ secrets.KEY_VAULT_DEPLOYMENT_KEY }}
${{ secrets.SSH_ASSETS_KEY }}
- name: Create env file
run: |
touch .env
echo -e "${{ secrets.PRODUCTION_ENV_VARS }}" | sed 's/\\n/\n/g' >> .env
cat .env
- name: Create env secret file
run: |
touch .env.secret
echo -e "${{ secrets.PRODUCTION_ENV_SECRET }}" | sed 's/\\n/\n/g' >> .env.secret
cat .env.secret
- name: Submodules update
run: git -c submodule.auto-test.update=none submodule update --init --recursive
- run: flutter pub cache repair
- run: flutter pub get
# Encrypt secrets before use
- name: Encrypt Secrets
run: |
./script/encrypt_secrets.sh ${{ secrets.ENTROPY }}
- name: Clone the Key Vault
run: |
git clone [email protected]:bitmark-inc/mobile-signing-key-vault.git --depth 1
cp mobile-signing-key-vault/android/bitmark-autonomy/release.keystore android/release.keystore
cp mobile-signing-key-vault/android/bitmark-autonomy/release.properties android/release.properties
- run: flutter build apk --flavor prd --release
- uses: actions/upload-artifact@v4
with:
name: autonomy-prd-release-${{ github.event.inputs.version }}
path: build/app/outputs/apk/prd/release/app-prd-release.apk
if-no-files-found: error
compression-level: 0
retention-days: 7