ci: add asset upload to delivery #53
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Delivery | |
# Delivery workflow runs integration, releases a new version and delivers | |
# (deploys) the version build to production environment (app stores) to be | |
# later published, for both iOS and Android platforms | |
env: | |
FLUTTER_VERSION: "3.22.x" | |
DEPLOYMENT_ENV_NAME: production | |
IOS_BUNDLE_NAME: cz.dronetag.drone-scanner | |
ANDROID_BUNDLE_NAME: cz.dronetag.dronescanner | |
ANDROID_TARGET_TRACK: internal | |
FLUTTER_BUILD_NUMBER: "10${{ github.run_number }}" | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
on: | |
push: | |
branches: | |
- production | |
- master | |
pull_request: | |
jobs: | |
integration: | |
name: Run integration | |
uses: ./.github/workflows/integration.yml | |
release-version: | |
name: Release new version | |
needs: integration | |
uses: dronetag/gha-shared/.github/workflows/create-release.yml@master | |
with: | |
must-release: false | |
secrets: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
start-deployment: | |
name: Create new GitHub deployment | |
runs-on: ubuntu-latest | |
needs: integration | |
outputs: | |
deployment-id: ${{ steps.start.outputs.deployment_id }} | |
steps: | |
- name: Start a new deployment | |
uses: bobheadxi/deployments@9d4477fdaa4120020cd10ab7e97f68c801422e73 | |
id: start | |
with: | |
step: start | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: ${{ env.DEPLOYMENT_ENV_NAME }} | |
build-publish-ios: | |
name: Build & publish iOS bundle | |
needs: | |
- release-version | |
- start-deployment | |
runs-on: macos-14 | |
timeout-minutes: 20 | |
env: | |
FLUTTER_BUILD_NAME: ${{ needs.release-version.outputs.version }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install the project | |
uses: dronetag/gha-shared/.github/actions/flutter-install@master | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
- name: Obtain iOS signing files | |
uses: dronetag/gha-shared/.github/actions/setup-ios-signing@master | |
with: | |
app-bundle-name: ${{ env.IOS_BUNDLE_NAME }} | |
appstore-private-key: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }} | |
appstore-key-id: ${{ secrets.APP_STORE_CONNECT_KEY_IDENTIFIER }} | |
appstore-issuer-id: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }} | |
certificate-private-key: ${{ secrets.IOS_CERT_PRIVATE_KEY }} | |
- name: Install Google Maps API key | |
env: | |
API_KEY: ${{ secrets.GMAPS_API_KEY_IOS }} | |
run: 'echo "$API_KEY" > ios/Runner/Secrets.plist' | |
- name: Build Flutter iOS app | |
run: > | |
flutter build ipa | |
--release | |
--build-name=$FLUTTER_BUILD_NAME | |
--build-number=$FLUTTER_BUILD_NUMBER | |
--export-options-plist="$HOME/export_options.plist" | |
- name: Upload debug symbols | |
run: dart run sentry_dart_plugin | |
- name: Upload built bundle as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ios-app-bundle | |
path: build/ios/ipa/*.ipa | |
if-no-files-found: error | |
build-publish-android: | |
name: Build & publish Android bundle | |
needs: | |
- release-version | |
- start-deployment | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 20 | |
env: | |
FLUTTER_BUILD_NAME: ${{ needs.release-version.outputs.version }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Install the project | |
uses: dronetag/gha-shared/.github/actions/flutter-install@master | |
with: | |
flutter-version: ${{ env.FLUTTER_VERSION }} | |
setup-java: true | |
- name: Make Android keystore file | |
run: | | |
echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 --decode > $HOME/android-keystore.jks | |
echo "keyAlias=${{ secrets.ANDROID_KEYSTORE_KEYALIAS }}" >> ./android/key.properties | |
echo "storePassword=${{ secrets.ANDROID_KEYSTORE_PASS }}" >> ./android/key.properties | |
echo "keyPassword=${{ secrets.ANDROID_KEYSTORE_PASS }}" >> ./android/key.properties | |
echo "${{ secrets.ANDROID_KEYSTORE_PASS }}" >> $HOME/keystore.pwd | |
echo "storeFile=$HOME/android-keystore.jks" >> ./android/key.properties | |
- name: Install Google Maps API key | |
env: | |
API_KEY: ${{ secrets.GMAPS_API_KEY_ANDROID }} | |
run: 'echo "$API_KEY" > android/app/src/main/res/values/secrets.xml' | |
- name: Build Flutter Android app | |
run: > | |
flutter build appbundle | |
--release | |
--build-name=$FLUTTER_BUILD_NAME | |
--build-number=$FLUTTER_BUILD_NUMBER | |
- name: Upload debug symbols | |
run: dart run sentry_dart_plugin | |
- name: Upload built bundle as artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: android-app-bundle | |
path: | | |
build/app/outputs/bundle/*/*.aab | |
build/app/outputs/mapping/release/mapping.txt | |
if-no-files-found: error | |
finish-deployment: | |
name: Finish GitHub deployment | |
if: always() | |
runs-on: ubuntu-latest | |
needs: | |
- start-deployment | |
- build-publish-ios | |
- build-publish-android | |
steps: | |
- name: Finish the deployment | |
uses: bobheadxi/deployments@9d4477fdaa4120020cd10ab7e97f68c801422e73 | |
id: deployment | |
with: | |
step: finish | |
deployment_id: ${{ needs.start-deployment.outputs.deployment-id }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
env: ${{ env.DEPLOYMENT_ENV_NAME }} | |
status: ${{ job.status }} | |
env_url: ${{ inputs.url }} | |
upload-assets: | |
name: Convert & upload release assets | |
runs-on: ubuntu-latest | |
needs: | |
- release-version | |
- build-publish-ios | |
- build-publish-android | |
env: | |
RELEASED_VERSION: ${{ needs.release-version.outputs.version }} | |
ANDROID_KEYSTORE_PATH: android-keystore.jks | |
ANDROID_KEYSTORE_PASS_PATH: keystore.pwd | |
ANDROID_BUNDLE_PATH: android-app-bundle/bundle/release/app-release.aab | |
IOS_APP_PATH: ios-app-bundle/DroneScanner.ipa | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Make Android keystore file | |
run: | | |
echo "${{ secrets.ANDROID_KEYSTORE }}" | base64 --decode > ${{ env.ANDROID_KEYSTORE_PATH }} | |
echo "${{ secrets.ANDROID_KEYSTORE_PASS }}" >> ${{ env.ANDROID_KEYSTORE_PASS_PATH }} | |
- name: Unpack Android ABB bundle into universal APK | |
uses: dronetag/gha-shared/.github/actions/unpack-aab@master | |
id: unpack-aab | |
with: | |
bundle-path: ${{ env.ANDROID_BUNDLE_PATH }} | |
key-store-path: ${{ env.ANDROID_KEYSTORE_PATH }} | |
key-store-pass-path: ${{ env.ANDROID_KEYSTORE_PASS_PATH }} | |
key-store-alias: ${{ secrets.ANDROID_KEYSTORE_KEYALIAS }} | |
- name: Upload unpacked APK to release | |
run: gh release upload v${{ env.RELEASED_VERSION }} "${{ steps.unpack-aab.outputs.filename }}" | |
- name: Upload rest of the artifacts to release | |
run: | | |
gh release upload v${{ env.RELEASED_VERSION }} "${{ env.ANDROID_BUNDLE_PATH }}" | |
gh release upload v${{ env.RELEASED_VERSION }} "${{ env.IOS_APP_PATH }}" |