Skip to content

MacMiniM2 Deploy appcenter Android app #955

MacMiniM2 Deploy appcenter Android app

MacMiniM2 Deploy appcenter Android app #955

name: MacMiniM2 Deploy appcenter Android app
on:
workflow_dispatch:
inputs:
version:
description: Build version (eg 0.30.0)
required: true
message:
description: Change logs
required: false
testnet:
type: boolean
default: false
required: false
description: Using testnet (Default staging)
workflow_call:
inputs:
version:
description: Build version (eg 0.30.0)
type: string
required: true
message:
description: Change logs
type: string
required: false
testnet:
type: boolean
default: false
required: false
description: Using testnet (Default staging)
jobs:
build:
runs-on: [self-hosted, macOS]
steps:
- name: Extract Build number for Testnet
id: extract-version-testnet
env:
APPCENTER_API_TOKEN: ${{ secrets.APPCENTER_API_TOKEN }}
APP_NAME: ${{ inputs.testnet == true && 'Autonomy-Android-Test' || 'Autonomy-Android-1'}}
run: |
echo "$APP_NAME"
API_RESPONSE=$(curl -X GET \
"https://api.appcenter.ms/v0.1/apps/support-zzd0-28/$APP_NAME/recent_releases" \
-H 'accept: application/json' \
-H "X-API-Token: $APPCENTER_API_TOKEN")
echo "$API_RESPONSE"
BUILD_NUMBER=$(echo "$API_RESPONSE" | jq -r '.[0].version')
# Increase the build number by 1
((BUILD_NUMBER++))
echo "$BUILD_NUMBER"
echo "FLUTTER_VERSION_CODE=$BUILD_NUMBER" >> "$GITHUB_ENV"
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: "zulu"
java-version: "17"
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.22.1"
channel: stable
- name: Set env
run: |
echo "FLUTTER_VERSION_NAME=${{ inputs.version }}" >> $GITHUB_ENV
# echo "FLUTTER_VERSION_CODE=${{ inputs.build-number }}" >> $GITHUB_ENV
echo "BRANCH_KEY=${{ secrets.BRANCH_KEY }}" >> $GITHUB_ENV
echo "BRANCH_KEY_TEST=${{ secrets.BRANCH_KEY_TEST }}" >> $GITHUB_ENV
${{ inputs.testnet == true }} && echo APPCENTER_APP_ID=support-zzd0-28/Autonomy-Android-Test >> $GITHUB_ENV || echo APPCENTER_APP_ID=support-zzd0-28/Autonomy-Android-1 >> $GITHUB_ENV
${{ inputs.testnet == true }} && echo NAME_SUFFIX=test-${{env.FLUTTER_VERSION_CODE}} >> $GITHUB_ENV || echo NAME_SUFFIX=main-${{env.FLUTTER_VERSION_CODE}} >> $GITHUB_ENV
- uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_ASSETS_KEY }}
- name: Create env file
run: |
touch .env
${{ inputs.testnet == true }} && echo -e "${{ secrets.DEV_ENV }}" | sed 's/\\n/\n/g' >> .env || echo -e "${{ secrets.STAGING_ENV }}" | sed 's/\\n/\n/g' >> .env
cat .env
- name: Submoudles update
run: git -c submodule.auto-test.update=none submodule update --init --recursive
- run: flutter pub cache repair
- run: flutter pub get
- run: flutter build apk --flavor inhouse
- run: mv build/app/outputs/flutter-apk/app-inhouse-release.apk build/app/outputs/flutter-apk/app-inhouse-release-${{ env.NAME_SUFFIX }}.apk
- name: Distribute apk to App Center
uses: akiojin/appcenter-distribute-github-action@v1
with:
token: ${{ secrets.APPCENTER_API_TOKEN }}
path: build/app/outputs/flutter-apk/app-inhouse-release-${{ env.NAME_SUFFIX }}.apk
app: ${{ env.APPCENTER_APP_ID }}
silent: false
group: "Collaborators,Bitmark Internal Testers"
release_notes: ${{ inputs.message }}
- name: Upload Sentry debug symbols
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH }}
run: |
flutter packages pub run sentry_dart_plugin