From 00c9dffeb3d5b6c4b1edda5d9d08af58225fb027 Mon Sep 17 00:00:00 2001 From: Jagandeep Brar Date: Fri, 1 Apr 2022 17:07:19 -0400 Subject: [PATCH] chore(ci): rewrite CI/CD pipeline to support additional platforms --- ...{release_android.yml => build_android.yml} | 117 +++--- .github/workflows/build_ios.yml | 104 ++++++ .github/workflows/build_linux.yml | 70 ++++ .github/workflows/build_macos.yml | 109 ++++++ .github/workflows/build_web.yml | 62 ++++ .github/workflows/generate_files.yml | 23 +- .github/workflows/prepare_build.yml | 34 +- .github/workflows/publish.yml | 347 ++++++++++++++++++ .github/workflows/release.yml | 154 ++++---- .github/workflows/release_ios.yml | 183 --------- .github/workflows/release_linux.yml | 121 ------ .github/workflows/release_macos.yml | 184 ---------- .github/workflows/release_web.yml | 122 ------ .github/workflows/validate.yml | 4 +- .gitignore | 7 + android/fastlane/Fastfile | 47 ++- android/fastlane/README.md | 20 +- ios/Runner.xcodeproj/project.pbxproj | 12 +- ios/fastlane/Fastfile | 6 +- ios/fastlane/Matchfile | 1 - macos/Runner.xcodeproj/project.pbxproj | 6 +- macos/fastlane/Fastfile | 6 +- macos/fastlane/Matchfile | 1 - 23 files changed, 946 insertions(+), 794 deletions(-) rename .github/workflows/{release_android.yml => build_android.yml} (51%) create mode 100644 .github/workflows/build_ios.yml create mode 100644 .github/workflows/build_linux.yml create mode 100644 .github/workflows/build_macos.yml create mode 100644 .github/workflows/build_web.yml create mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/release_ios.yml delete mode 100644 .github/workflows/release_linux.yml delete mode 100644 .github/workflows/release_macos.yml delete mode 100644 .github/workflows/release_web.yml diff --git a/.github/workflows/release_android.yml b/.github/workflows/build_android.yml similarity index 51% rename from .github/workflows/release_android.yml rename to .github/workflows/build_android.yml index 3a3e3b4f..6fc7c88b 100644 --- a/.github/workflows/release_android.yml +++ b/.github/workflows/build_android.yml @@ -3,31 +3,21 @@ name: '[Release] Android' on: workflow_call: inputs: - build_flavor: - required: true - type: string build_number: required: true type: string - build_version: - required: true - type: string secrets: - DISCORD_WEBHOOK: - required: true FIREBASE_OPTIONS: required: true - GOOGLE_PLAY_API: - required: true KEY_JKS: required: true KEY_PROPERTIES: required: true jobs: - build: - name: Build + build_app_bundle: + name: App Bundle runs-on: ubuntu-latest steps: - name: Checkout Repository @@ -36,15 +26,15 @@ jobs: fetch-depth: 0 - name: Download Source Files - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: - name: lib-${{ github.sha }} + name: lib path: ${{ github.workspace }}/lib - name: Download Localization Files - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: - name: localization-${{ github.sha }} + name: localization path: ${{ github.workspace }}/assets/localization - name: Install Secrets @@ -83,68 +73,79 @@ jobs: SUPPLY_JSON_KEY: ${{ github.workspace }}/.fastlane-android-auth.json run: | bundle install - bundle exec fastlane build build_number:${{ inputs.build_number }} - - - name: Upload App Bundle Artifact - uses: actions/upload-artifact@v2 - with: - name: android-${{ inputs.build_flavor }}-${{ github.sha }} - path: ${{ github.workspace }}/build/app/outputs/bundle/release/app-release.aab + bundle exec fastlane build_aab build_number:${{ inputs.build_number }} - - name: Send Discord Message - uses: sarisia/actions-status-discord@v1 - if: always() - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + - name: Upload Artifact + uses: actions/upload-artifact@v3 with: - title: '`[${{ inputs.build_flavor }}]` Android Build' - description: android-${{ inputs.build_flavor }}-${{ github.sha }} + name: android-app-bundle + path: ${{ github.workspace }}/output - deploy: - name: Deploy + build_app_package: + name: App Package runs-on: ubuntu-latest - needs: [ build ] steps: - name: Checkout Repository uses: actions/checkout@v2 - - - name: Determine Release Channel - id: channel - uses: actions/github-script@v6 - env: - FLAVOR: ${{ inputs.ref }} with: - result-encoding: string - script: | - const ref = process.env.FLAVOR || "edge"; - switch (ref) { - case "beta": return "alpha"; - case "candidate": return "beta"; - case "stable": return "production"; - case "edge": - default: return "internal"; - } + fetch-depth: 0 - - name: Download App Package Artifact - uses: actions/download-artifact@v2 + - name: Download Source Files + uses: actions/download-artifact@v3 with: - name: android-${{ inputs.build_flavor }}-${{ github.sha }} - path: ${{ github.workspace }} + name: lib + path: ${{ github.workspace }}/lib - - name: Install Secret Keys + - name: Download Localization Files + uses: actions/download-artifact@v3 + with: + name: localization + path: ${{ github.workspace }}/assets/localization + + - name: Install Secrets working-directory: ${{ github.workspace }} run: | - echo ${{ secrets.GOOGLE_PLAY_API }} | base64 --decode > .fastlane-android-auth.json + echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart + echo ${{ secrets.KEY_JKS }} | base64 --decode > android/key.jks + echo ${{ secrets.KEY_PROPERTIES }} | base64 --decode > android/key.properties - name: Install Ruby uses: ruby/setup-ruby@v1 with: bundler-cache: true - - name: Deploy to Google Play Store + - name: Install Java + uses: actions/setup-java@v2 + with: + distribution: zulu + java-version: 11 + + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + cache-key: ${{ github.sha }} + + - name: Setup Flutter + working-directory: ${{ github.workspace }} + run: | + flutter pub get + + - name: Setup Fastlane + working-directory: ${{ github.workspace }}/android + run: | + bundle install + + - name: Run Fastlane working-directory: ${{ github.workspace }}/android env: SUPPLY_JSON_KEY: ${{ github.workspace }}/.fastlane-android-auth.json run: | - bundle install - bundle exec fastlane deploy track:${{ steps.channel.outputs.result }} aab:${{ github.workspace }}/app-release.aab version_name:${{ github.sha }} + bundle exec fastlane build_apk build_number:${{ inputs.build_number }} + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: android-app-package + path: ${{ github.workspace }}/output diff --git a/.github/workflows/build_ios.yml b/.github/workflows/build_ios.yml new file mode 100644 index 00000000..9dee2bab --- /dev/null +++ b/.github/workflows/build_ios.yml @@ -0,0 +1,104 @@ +name: '[Release] iOS' + +on: + workflow_call: + inputs: + build_number: + required: true + type: string + + secrets: + APPLE_ID: + required: true + APPLE_ITC_TEAM_ID: + required: true + APPLE_TEAM_ID: + required: true + FIREBASE_OPTIONS: + required: true + MATCH_KEYCHAIN_NAME: + required: true + MATCH_KEYCHAIN_PASSWORD: + required: true + MATCH_PASSWORD: + required: true + MATCH_SSH_PRIVATE_KEY: + required: true + +jobs: + build_app_package: + name: App Package + runs-on: macos-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Download Source Files + uses: actions/download-artifact@v3 + with: + name: lib + path: ${{ github.workspace }}/lib + + - name: Download Localization Files + uses: actions/download-artifact@v3 + with: + name: localization + path: ${{ github.workspace }}/assets/localization + + - name: Select Xcode Version + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + + - name: Install Secrets + working-directory: ${{ github.workspace }} + run: | + echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart + + - name: Setup SSH Agent + uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }} + + - name: Install Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + cache-key: ${{ github.sha }} + + - name: Setup Flutter + working-directory: ${{ github.workspace }} + run: | + flutter pub get + + - name: Install Pods + working-directory: ${{ github.workspace }}/ios + run: | + pod install --repo-update + + - name: Run Fastlane + working-directory: ${{ github.workspace }}/ios + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} + MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} + run: | + bundle install + bundle exec fastlane build build_number:${{ inputs.build_number }} + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: ios-app-package + path: ${{ github.workspace }}/output diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml new file mode 100644 index 00000000..0f00c5e8 --- /dev/null +++ b/.github/workflows/build_linux.yml @@ -0,0 +1,70 @@ +name: '[Release] Linux' + +on: + workflow_call: + inputs: + build_number: + required: true + type: string + + secrets: + FIREBASE_OPTIONS: + required: true + +jobs: + build_snap: + name: Snap + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Download Source Files + uses: actions/download-artifact@v3 + with: + name: lib + path: ${{ github.workspace }}/lib + + - name: Download Localization Files + uses: actions/download-artifact@v3 + with: + name: localization + path: ${{ github.workspace }}/assets/localization + + - name: Install Secrets + working-directory: ${{ github.workspace }} + run: | + echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart + + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + cache-key: ${{ github.sha }} + + - name: Setup Flutter + working-directory: ${{ github.workspace }} + run: | + flutter pub get + + - name: Build LunaSea + uses: snapcore/action-build@v1 + id: build + + - name: Prepare Folder + run: | + mkdir -p ${{ github.workspace }}/output + + - name: Move Snap + working-directory: ${{ github.workspace }} + run: | + mv ${{ steps.build.outputs.snap }} ${{ github.workspace }}/output/LunaSea-Linux-amd64.snap + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: linux-snap + path: ${{ github.workspace }}/output diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml new file mode 100644 index 00000000..5d93b8d6 --- /dev/null +++ b/.github/workflows/build_macos.yml @@ -0,0 +1,109 @@ +name: '[Release] macOS' + +on: + workflow_call: + inputs: + build_number: + required: true + type: string + + secrets: + APPLE_ID: + required: true + APPLE_ITC_TEAM_ID: + required: true + APPLE_TEAM_ID: + required: true + FIREBASE_OPTIONS: + required: true + MATCH_KEYCHAIN_NAME: + required: true + MATCH_KEYCHAIN_PASSWORD: + required: true + MATCH_PASSWORD: + required: true + MATCH_SSH_PRIVATE_KEY: + required: true + +jobs: + build_app_package: + name: App Package + runs-on: macos-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Download Source Files + uses: actions/download-artifact@v3 + with: + name: lib + path: ${{ github.workspace }}/lib + + - name: Download Localization Files + uses: actions/download-artifact@v3 + with: + name: localization + path: ${{ github.workspace }}/assets/localization + + - name: Select Xcode Version + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: latest-stable + + - name: Install Secrets + working-directory: ${{ github.workspace }} + run: | + echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart + + - name: Setup SSH Agent + uses: webfactory/ssh-agent@v0.5.4 + with: + ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }} + + - name: Install Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + cache-key: ${{ github.sha }} + + - name: Setup Flutter + working-directory: ${{ github.workspace }} + run: | + flutter config --enable-macos-desktop + flutter pub get + + - name: Setup Fastlane + working-directory: ${{ github.workspace }}/macos + run: | + + - name: Install Pods + working-directory: ${{ github.workspace }}/macos + run: | + pod install --repo-update + + - name: Run Fastlane + working-directory: ${{ github.workspace }}/macos + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} + MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + run: | + bundle install + bundle exec fastlane build build_number:${{ inputs.build_number }} + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: macos-app-package + path: ${{ github.workspace }}/output diff --git a/.github/workflows/build_web.yml b/.github/workflows/build_web.yml new file mode 100644 index 00000000..2c2a12a2 --- /dev/null +++ b/.github/workflows/build_web.yml @@ -0,0 +1,62 @@ +name: '[Release] Web' + +on: + workflow_call: + inputs: + build_number: + required: true + type: string + + secrets: + FIREBASE_OPTIONS: + required: true + +jobs: + build: + name: CanvasKit + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Download Source Files + uses: actions/download-artifact@v3 + with: + name: lib + path: ${{ github.workspace }}/lib + + - name: Download Localization Files + uses: actions/download-artifact@v3 + with: + name: localization + path: ${{ github.workspace }}/assets/localization + + - name: Install Secrets + working-directory: ${{ github.workspace }} + run: | + echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart + + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + channel: stable + cache: true + cache-key: ${{ github.sha }} + + - name: Setup Flutter + working-directory: ${{ github.workspace }} + run: | + flutter pub get + + - name: Build LunaSea + working-directory: ${{ github.workspace }} + run: | + flutter build web --web-renderer canvaskit --release + + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: web-canvaskit + path: ${{ github.workspace }}/build/web diff --git a/.github/workflows/generate_files.yml b/.github/workflows/generate_files.yml index 30530bb0..3db6fdd2 100644 --- a/.github/workflows/generate_files.yml +++ b/.github/workflows/generate_files.yml @@ -2,6 +2,17 @@ name: Generate Files on: workflow_call: + inputs: + build_flavor: + required: true + type: string + build_number: + required: true + type: string + build_version: + required: true + type: string + secrets: FIREBASE_OPTIONS: required: true @@ -15,9 +26,9 @@ jobs: uses: actions/checkout@v2 - name: Download Flavor Configuration - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: - name: flavor-${{ github.sha }} + name: flavor path: ${{ github.workspace }} - name: Install Secrets @@ -39,9 +50,9 @@ jobs: flutter packages pub run build_runner build - name: Upload Source Files - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: - name: lib-${{ github.sha }} + name: lib path: ${{ github.workspace }}/lib/**/*.g.dart localization: @@ -60,7 +71,7 @@ jobs: dart ./scripts/generate_localization.dart - name: Upload Localization Files - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: - name: localization-${{ github.sha }} + name: localization path: ${{ github.workspace }}/assets/localization diff --git a/.github/workflows/prepare_build.yml b/.github/workflows/prepare_build.yml index 519fd061..cadcaa4c 100644 --- a/.github/workflows/prepare_build.yml +++ b/.github/workflows/prepare_build.yml @@ -17,6 +17,9 @@ on: version: description: "Build Version" value: ${{ jobs.version.outputs.output1 }} + title: + description: "Build Title" + value: ${{ jobs.title.outputs.output1 }} jobs: flavor: @@ -53,9 +56,9 @@ jobs: echo $'FLAVOR=${{ steps.script.outputs.result }}\nCOMMIT=${{ github.sha }}' > .flavor - name: Upload Flavor Configuration - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: - name: flavor-${{ github.sha }} + name: flavor path: ${{ github.workspace }}/.flavor number: @@ -72,8 +75,8 @@ jobs: - name: Count Commits id: commit_count run: | - count=`git rev-list HEAD --count` - echo "::set-output name=commit_count::$count" + COUNT=`git rev-list HEAD --count` + echo "::set-output name=commit_count::$COUNT" - name: Run Script id: script @@ -114,3 +117,26 @@ jobs: run: | echo ${{ steps.version.outputs.current-version }} echo "::set-output name=number::${{ steps.version.outputs.current-version }}" + + title: + name: Title + needs: [ flavor, number, version ] + runs-on: ubuntu-latest + outputs: + output1: ${{ steps.output.outputs.title }} + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Determine Short Hash + id: hash + run: | + HASH=`git rev-parse --short ${{ github.sha }}` + echo "::set-output name=hash::$HASH" + + - name: Set Output + id: output + run: | + TITLE="v${{ needs.version.outputs.output1 }}-${{ needs.flavor.outputs.output1 }}-${{ needs.number.outputs.output1 }}-${{ steps.hash.outputs.hash }}" + echo $TITLE + echo "::set-output name=title::$TITLE" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..9ce32a21 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,347 @@ +name: 'Publish Releases' + +on: + workflow_call: + inputs: + build_flavor: + required: true + type: string + build_number: + required: true + type: string + build_title: + required: true + type: string + build_version: + required: true + type: string + + secrets: + APPLE_ID: + required: true + APPLE_ITC_TEAM_ID: + required: true + APPLE_STORE_CONNECT_ISSUER_ID: + required: true + APPLE_STORE_CONNECT_KEY: + required: true + APPLE_STORE_CONNECT_KEY_FILEPATH: + required: true + APPLE_STORE_CONNECT_KEY_ID: + required: true + APPLE_TEAM_ID: + required: true + GOOGLE_PLAY_API: + required: true + NETLIFY_AUTH_TOKEN: + required: true + SNAPCRAFT_TOKEN: + required: true + S3_ACCESS_KEY: + required: true + S3_BUCKET: + required: true + S3_ENDPOINT: + required: true + S3_KEY_ID: + required: true + S3_REGION: + required: true + +jobs: + android_play_store: + name: Play Store + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Prepare Folder + run: | + mkdir -p ${{ github.workspace }}/output + + - name: Install Secrets + working-directory: ${{ github.workspace }} + run: | + echo ${{ secrets.GOOGLE_PLAY_API }} | base64 --decode > .fastlane-android-auth.json + + - name: Install Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Download Android App Package + uses: actions/download-artifact@v3 + with: + name: android-app-package + path: ${{ github.workspace }}/output + + - name: Determine Release Channel + id: channel + uses: actions/github-script@v6 + env: + FLAVOR: ${{ inputs.build_flavor }} + with: + result-encoding: string + script: | + const ref = process.env.FLAVOR || "edge"; + switch (ref) { + case "beta": return "alpha"; + case "candidate": return "beta"; + case "stable": return "production"; + case "edge": + default: return "internal"; + } + + - name: Deploy to Google Play Store + working-directory: ${{ github.workspace }}/android + env: + SUPPLY_JSON_KEY: ${{ github.workspace }}/.fastlane-android-auth.json + run: | + bundle install + bundle exec fastlane deploy track:${{ steps.channel.outputs.result }} aab:${{ github.workspace }}/output/LunaSea-Android.aab version_name:${{ github.sha }} + + ios_app_store: + name: App Store (iOS) + runs-on: macos-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Prepare Folder + run: | + mkdir -p ${{ github.workspace }}/output + + - name: Install Secrets + working-directory: ${{ github.workspace }} + run: | + echo ${{ secrets.APPLE_STORE_CONNECT_KEY }} | base64 --decode > ios/${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }} + + - name: Install Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Download macOS App Package + uses: actions/download-artifact@v3 + with: + name: macos-app-package + path: ${{ github.workspace }}/output + + - name: Determine Release Channel + id: channel + uses: actions/github-script@v6 + env: + FLAVOR: ${{ inputs.build_flavor }} + with: + result-encoding: string + script: | + const ref = process.env.FLAVOR || "edge"; + switch (ref) { + case "beta": return "beta"; + case "candidate": return "candidate"; + case "stable": return "stable"; + case "edge": + default: return "edge"; + } + + - name: Deploy to App Store Connect + working-directory: ${{ github.workspace }}/macos + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} + APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} + APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }} + APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + run: | + bundle exec fastlane deploy groups:${{ steps.channel.outputs.result }} pkg:${{ github.workspace }}/output/LunaSea-macOS.pkg + + macos_app_store: + name: App Store (macOS) + runs-on: macos-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Prepare Folder + run: | + mkdir -p ${{ github.workspace }}/output + + - name: Install Secrets + working-directory: ${{ github.workspace }} + run: | + echo ${{ secrets.APPLE_STORE_CONNECT_KEY }} | base64 --decode > ios/${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }} + + - name: Install Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Download iOS App Package + uses: actions/download-artifact@v3 + with: + name: ios-app-package + path: ${{ github.workspace }}/output + + - name: Determine Release Channel + id: channel + uses: actions/github-script@v6 + env: + FLAVOR: ${{ inputs.build_flavor }} + with: + result-encoding: string + script: | + const ref = process.env.FLAVOR || "edge"; + switch (ref) { + case "beta": return "beta"; + case "candidate": return "candidate"; + case "stable": return "stable"; + case "edge": + default: return "edge"; + } + + - name: Deploy to App Store Connect + working-directory: ${{ github.workspace }}/ios + env: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} + APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} + APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }} + APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + run: | + bundle install + bundle exec fastlane deploy groups:${{ steps.channel.outputs.result }} ipa:${{ github.workspace }}/output/LunaSea-iOS.ipa + + linux_snapcraft: + name: Snapcraft + runs-on: ubuntu-latest + steps: + - name: Prepare Folder + run: | + mkdir -p ${{ github.workspace }}/output + + - name: Download Linux Snap + uses: actions/download-artifact@v3 + with: + name: linux-snap + path: ${{ github.workspace }}/output + + - name: Determine Release Channel + id: channel + uses: actions/github-script@v6 + env: + FLAVOR: ${{ inputs.build_flavor }} + with: + result-encoding: string + script: | + const ref = process.env.FLAVOR || "edge"; + switch (ref) { + case "beta": return "beta"; + case "candidate": return "candidate"; + case "stable": return "stable"; + case "edge": + default: return "edge"; + } + + - name: Install Snapcraft + uses: samuelmeuli/action-snapcraft@v1 + with: + snapcraft_token: ${{ secrets.SNAPCRAFT_TOKEN }} + + - name: Deploy to Snapcraft + run: | + snapcraft upload --release=${{ inputs.build_flavor }} ${{ github.workspace }}/output/LunaSea-Linux-amd64.snap + + web_netlify: + name: Netlify + runs-on: ubuntu-latest + steps: + - name: Prepare Folder + run: | + mkdir -p ${{ github.workspace }}/output + + - name: Download Android App Package + uses: actions/download-artifact@v3 + with: + name: web-canvaskit + path: ${{ github.workspace }}/output + + - name: Determine Release Channel + id: channel + uses: actions/github-script@v6 + env: + FLAVOR: ${{ inputs.build_flavor }} + with: + result-encoding: string + script: | + const ref = process.env.FLAVOR || "edge"; + switch (ref) { + case "beta": return "11ef2676-fc31-41b5-897b-fd21273d87ed"; + case "candidate": return "4636e6a1-17ef-45a2-a2b6-3d1c166fd1df"; + case "stable": return "6634f0b1-323c-4a2f-bd0b-8f1f388673a9"; + case "edge": + default: return "325e197e-55f4-449a-b2bb-6831fe47bf2a"; + } + + - name: Deploy to Netlify + uses: nwtgck/actions-netlify@v1.2 + env: + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + NETLIFY_SITE_ID: ${{ steps.channel.outputs.result }} + with: + publish-dir: ${{ github.workspace}}/output + production-deploy: true + deploy-message: ${{ inputs.build_title }} + + s3: + name: S3 + runs-on: ubuntu-latest + steps: + - name: Prepare Folder + run: | + mkdir -p ${{ github.workspace }}/output + + - name: Download Android App Bundle + uses: actions/download-artifact@v3 + with: + name: android-app-bundle + path: ${{ github.workspace }}/output + + - name: Download Android App Package + uses: actions/download-artifact@v3 + with: + name: android-app-package + path: ${{ github.workspace }}/output + + - name: Download iOS App Package + uses: actions/download-artifact@v3 + with: + name: ios-app-package + path: ${{ github.workspace }}/output + + - name: Download Linux Snap + uses: actions/download-artifact@v3 + with: + name: linux-snap + path: ${{ github.workspace }}/output + + - name: Download macOS App Package + uses: actions/download-artifact@v3 + with: + name: macos-app-package + path: ${{ github.workspace }}/output + + - name: Upload to S3 Bucket + uses: jakejarvis/s3-sync-action@v0.5.1 + with: + args: --acl public-read --follow-symlinks + env: + AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} + AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }} + AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + AWS_REGION: ${{ secrets.S3_REGION }} + SOURCE_DIR: ${{ github.workspace }}/output + DEST_DIR: ${{ inputs.build_title }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9ecc9dfd..4f5aee12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,50 +27,101 @@ jobs: with: access_token: ${{ github.token }} - prepare_build: + prepare: name: Prepare Build needs: [ cancel ] uses: JagandeepBrar/LunaSea/.github/workflows/prepare_build.yml@master with: ref: ${{ github.event.inputs.flavor }} - generate_files: - name: Generate - needs: [ prepare_build ] + generate: + name: Generate Files + needs: [ prepare ] uses: JagandeepBrar/LunaSea/.github/workflows/generate_files.yml@master + with: + build_flavor: ${{ needs.prepare.outputs.flavor }} + build_number: ${{ needs.prepare.outputs.number }} + build_version: ${{ needs.prepare.outputs.version }} secrets: FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} validate: name: Validate - needs: [ generate_files ] + needs: [ generate ] uses: JagandeepBrar/LunaSea/.github/workflows/validate.yml@master secrets: FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} - android: - name: Android - needs: [ prepare_build, validate ] - uses: JagandeepBrar/LunaSea/.github/workflows/release_android.yml@master + build_android: + name: Build Android + needs: [ prepare, validate ] + uses: JagandeepBrar/LunaSea/.github/workflows/build_android.yml@master with: - build_flavor: ${{ needs.prepare_build.outputs.flavor }} - build_number: ${{ needs.prepare_build.outputs.number }} - build_version: ${{ needs.prepare_build.outputs.version }} + build_number: ${{ needs.prepare.outputs.number }} secrets: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} - GOOGLE_PLAY_API: ${{ secrets.GOOGLE_PLAY_API }} KEY_JKS: ${{ secrets.KEY_JKS }} KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }} - ios: - name: iOS - needs: [ prepare_build, validate ] - uses: JagandeepBrar/LunaSea/.github/workflows/release_ios.yml@master + build_ios: + name: Build iOS + needs: [ prepare, validate ] + uses: JagandeepBrar/LunaSea/.github/workflows/build_ios.yml@master with: - build_flavor: ${{ needs.prepare_build.outputs.flavor }} - build_number: ${{ needs.prepare_build.outputs.number }} - build_version: ${{ needs.prepare_build.outputs.version }} + build_number: ${{ needs.prepare.outputs.number }} + secrets: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} + MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} + MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + MATCH_SSH_PRIVATE_KEY: ${{ secrets.MATCH_SSH_PRIVATE_KEY }} + + build_linux: + name: Build Linux + needs: [ prepare, validate ] + uses: JagandeepBrar/LunaSea/.github/workflows/build_linux.yml@master + with: + build_number: ${{ needs.prepare.outputs.number }} + secrets: + FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} + + build_macos: + name: Build macOS + needs: [ prepare, validate ] + uses: JagandeepBrar/LunaSea/.github/workflows/build_macos.yml@master + with: + build_number: ${{ needs.prepare.outputs.number }} + secrets: + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} + MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} + MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} + MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} + MATCH_SSH_PRIVATE_KEY: ${{ secrets.MATCH_SSH_PRIVATE_KEY }} + + build_web: + name: Build Web + needs: [ prepare, validate ] + uses: JagandeepBrar/LunaSea/.github/workflows/build_web.yml@master + with: + build_number: ${{ needs.prepare.outputs.number }} + secrets: + FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} + + publish: + name: Publish + needs: [ prepare, build_android, build_ios, build_linux, build_macos, build_web ] + uses: JagandeepBrar/LunaSea/.github/workflows/publish.yml@master + with: + build_flavor: ${{ needs.prepare.outputs.flavor }} + build_number: ${{ needs.prepare.outputs.number }} + build_title: ${{ needs.prepare.outputs.title }} + build_version: ${{ needs.prepare.outputs.version }} secrets: APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} @@ -79,58 +130,11 @@ jobs: APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }} APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} - MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} - MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_SSH_PRIVATE_KEY: ${{ secrets.MATCH_SSH_PRIVATE_KEY }} - - linux: - name: Linux - needs: [ prepare_build, validate ] - uses: JagandeepBrar/LunaSea/.github/workflows/release_linux.yml@master - with: - build_flavor: ${{ needs.prepare_build.outputs.flavor }} - build_number: ${{ needs.prepare_build.outputs.number }} - build_version: ${{ needs.prepare_build.outputs.version }} - secrets: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} - SNAPCRAFT_TOKEN: ${{ secrets.SNAPCRAFT_TOKEN }} - - macos: - name: macOS - needs: [ prepare_build, validate ] - uses: JagandeepBrar/LunaSea/.github/workflows/release_macos.yml@master - with: - build_flavor: ${{ needs.prepare_build.outputs.flavor }} - build_number: ${{ needs.prepare_build.outputs.number }} - build_version: ${{ needs.prepare_build.outputs.version }} - secrets: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} - APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} - APPLE_STORE_CONNECT_KEY: ${{ secrets.APPLE_STORE_CONNECT_KEY }} - APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }} - APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} - MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} - MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_SSH_PRIVATE_KEY: ${{ secrets.MATCH_SSH_PRIVATE_KEY }} - - web: - name: Web - needs: [ prepare_build, validate ] - uses: JagandeepBrar/LunaSea/.github/workflows/release_web.yml@master - with: - build_flavor: ${{ needs.prepare_build.outputs.flavor }} - build_number: ${{ needs.prepare_build.outputs.number }} - build_version: ${{ needs.prepare_build.outputs.version }} - secrets: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} + GOOGLE_PLAY_API: ${{ secrets.GOOGLE_PLAY_API }} NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + SNAPCRAFT_TOKEN: ${{ secrets.SNAPCRAFT_TOKEN }} + S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} + S3_BUCKET: ${{ secrets.S3_BUCKET }} + S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }} + S3_KEY_ID: ${{ secrets.S3_KEY_ID }} + S3_REGION: ${{ secrets.S3_REGION }} diff --git a/.github/workflows/release_ios.yml b/.github/workflows/release_ios.yml deleted file mode 100644 index de12f5f1..00000000 --- a/.github/workflows/release_ios.yml +++ /dev/null @@ -1,183 +0,0 @@ -name: '[Release] iOS' - -on: - workflow_call: - inputs: - build_flavor: - required: true - type: string - build_number: - required: true - type: string - build_version: - required: true - type: string - - secrets: - APPLE_ID: - required: true - APPLE_ITC_TEAM_ID: - required: true - APPLE_STORE_CONNECT_ISSUER_ID: - required: true - APPLE_STORE_CONNECT_KEY: - required: true - APPLE_STORE_CONNECT_KEY_FILEPATH: - required: true - APPLE_STORE_CONNECT_KEY_ID: - required: true - APPLE_TEAM_ID: - required: true - DISCORD_WEBHOOK: - required: true - FIREBASE_OPTIONS: - required: true - MATCH_KEYCHAIN_NAME: - required: true - MATCH_KEYCHAIN_PASSWORD: - required: true - MATCH_PASSWORD: - required: true - MATCH_SSH_PRIVATE_KEY: - required: true - -jobs: - build: - name: Build - runs-on: macos-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download Source Files - uses: actions/download-artifact@v2 - with: - name: lib-${{ github.sha }} - path: ${{ github.workspace }}/lib - - - name: Download Localization Files - uses: actions/download-artifact@v2 - with: - name: localization-${{ github.sha }} - path: ${{ github.workspace }}/assets/localization - - - name: Select Xcode Version - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: latest-stable - - - name: Install Secrets - working-directory: ${{ github.workspace }} - run: | - echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart - - - name: Setup SSH Agent - uses: webfactory/ssh-agent@v0.5.4 - with: - ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }} - - - name: Install Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Install Flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - cache: true - cache-key: ${{ github.sha }} - - - name: Setup Flutter - working-directory: ${{ github.workspace }} - run: | - flutter pub get - - - name: Install Pods - working-directory: ${{ github.workspace }}/ios - run: | - pod install --repo-update - - - name: Run Fastlane - working-directory: ${{ github.workspace }}/ios - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} - MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} - run: | - bundle install - bundle exec fastlane build build_number:${{ inputs.build_number }} - - - name: Upload App Package Artifact - uses: actions/upload-artifact@v2 - with: - name: ios-${{ inputs.build_flavor }}-${{ github.sha }} - path: ${{ github.workspace }}/ios/Runner.ipa - - - name: Send Discord Message - uses: sarisia/actions-status-discord@v1 - if: always() - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - with: - title: '`[${{ inputs.build_flavor }}]` iOS Build' - description: ios-${{ inputs.build_flavor }}-${{ github.sha }} - - deploy: - name: Deploy - runs-on: macos-latest - needs: [ build ] - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Determine Release Channel - id: channel - uses: actions/github-script@v6 - env: - FLAVOR: ${{ inputs.ref }} - with: - result-encoding: string - script: | - const ref = process.env.FLAVOR || "edge"; - switch (ref) { - case "beta": return "beta"; - case "candidate": return "candidate"; - case "stable": return "stable"; - case "edge": - default: return "edge"; - } - - - name: Download App Package Artifact - uses: actions/download-artifact@v2 - with: - name: ios-${{ inputs.build_flavor }}-${{ github.sha }} - path: ${{ github.workspace }} - - - name: Install Secret Keys - working-directory: ${{ github.workspace }} - run: | - echo ${{ secrets.APPLE_STORE_CONNECT_KEY }} | base64 --decode > ios/${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }} - - - name: Install Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Deploy to App Store Connect - working-directory: ${{ github.workspace }}/ios - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} - APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} - APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }} - APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - run: | - bundle install - bundle exec fastlane deploy groups:${{ steps.channel.outputs.result }} ipa:${{ github.workspace }}/Runner.ipa diff --git a/.github/workflows/release_linux.yml b/.github/workflows/release_linux.yml deleted file mode 100644 index cfaff004..00000000 --- a/.github/workflows/release_linux.yml +++ /dev/null @@ -1,121 +0,0 @@ -name: '[Release] Linux' - -on: - workflow_call: - inputs: - build_flavor: - required: true - type: string - build_number: - required: true - type: string - build_version: - required: true - type: string - - secrets: - DISCORD_WEBHOOK: - required: true - FIREBASE_OPTIONS: - required: true - SNAPCRAFT_TOKEN: - required: true - -jobs: - build: - name: Build - runs-on: ubuntu-latest - outputs: - output1: ${{ steps.build.outputs.snap }} - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download Source Files - uses: actions/download-artifact@v2 - with: - name: lib-${{ github.sha }} - path: ${{ github.workspace }}/lib - - - name: Download Localization Files - uses: actions/download-artifact@v2 - with: - name: localization-${{ github.sha }} - path: ${{ github.workspace }}/assets/localization - - - name: Install Secrets - working-directory: ${{ github.workspace }} - run: | - echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart - - - name: Install Flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - cache: true - cache-key: ${{ github.sha }} - - - name: Setup Flutter - working-directory: ${{ github.workspace }} - run: | - flutter pub get - - - name: Build LunaSea - uses: snapcore/action-build@v1 - id: build - - - name: Upload Snap Build Artifact - uses: actions/upload-artifact@v2 - with: - name: linux-${{ inputs.build_flavor }}-${{ github.sha }} - path: ${{ steps.build.outputs.snap }} - - - name: Send Discord Message - uses: sarisia/actions-status-discord@v1 - if: always() - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - with: - title: '`[${{ inputs.build_flavor }}]` Linux Build' - description: linux-${{ inputs.build_flavor }}-${{ github.sha }} - - deploy: - name: Deploy - runs-on: ubuntu-latest - needs: [ build ] - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Determine Release Channel - id: channel - uses: actions/github-script@v6 - env: - FLAVOR: ${{ inputs.ref }} - with: - result-encoding: string - script: | - const ref = process.env.FLAVOR || "edge"; - switch (ref) { - case "beta": return "beta"; - case "candidate": return "candidate"; - case "stable": return "stable"; - case "edge": - default: return "edge"; - } - - - name: Install Snapcraft - uses: samuelmeuli/action-snapcraft@v1 - with: - snapcraft_token: ${{ secrets.SNAPCRAFT_TOKEN }} - - - name: Download Snap Build Artifact - uses: actions/download-artifact@v2 - with: - name: linux-${{ inputs.build_flavor }}-${{ github.sha }} - - - name: Deploy to Snapcraft - run: | - snapcraft upload --release=${{ inputs.build_flavor }} ${{ needs.build.outputs.output1 }} diff --git a/.github/workflows/release_macos.yml b/.github/workflows/release_macos.yml deleted file mode 100644 index 64712c32..00000000 --- a/.github/workflows/release_macos.yml +++ /dev/null @@ -1,184 +0,0 @@ -name: '[Release] macOS' - -on: - workflow_call: - inputs: - build_flavor: - required: true - type: string - build_number: - required: true - type: string - build_version: - required: true - type: string - - secrets: - APPLE_ID: - required: true - APPLE_ITC_TEAM_ID: - required: true - APPLE_STORE_CONNECT_ISSUER_ID: - required: true - APPLE_STORE_CONNECT_KEY: - required: true - APPLE_STORE_CONNECT_KEY_FILEPATH: - required: true - APPLE_STORE_CONNECT_KEY_ID: - required: true - APPLE_TEAM_ID: - required: true - DISCORD_WEBHOOK: - required: true - FIREBASE_OPTIONS: - required: true - MATCH_KEYCHAIN_NAME: - required: true - MATCH_KEYCHAIN_PASSWORD: - required: true - MATCH_PASSWORD: - required: true - MATCH_SSH_PRIVATE_KEY: - required: true - -jobs: - build: - name: Build - runs-on: macos-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download Source Files - uses: actions/download-artifact@v2 - with: - name: lib-${{ github.sha }} - path: ${{ github.workspace }}/lib - - - name: Download Localization Files - uses: actions/download-artifact@v2 - with: - name: localization-${{ github.sha }} - path: ${{ github.workspace }}/assets/localization - - - name: Select Xcode Version - uses: maxim-lobanov/setup-xcode@v1 - with: - xcode-version: latest-stable - - - name: Install Secrets - working-directory: ${{ github.workspace }} - run: | - echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart - - - name: Setup SSH Agent - uses: webfactory/ssh-agent@v0.5.4 - with: - ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }} - - - name: Install Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Install Flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - cache: true - cache-key: ${{ github.sha }} - - - name: Setup Flutter - working-directory: ${{ github.workspace }} - run: | - flutter config --enable-macos-desktop - flutter pub get - - - name: Install Pods - working-directory: ${{ github.workspace }}/macos - run: | - pod install --repo-update - - - name: Run Fastlane - working-directory: ${{ github.workspace }}/macos - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }} - MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }} - MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} - run: | - bundle install - bundle exec fastlane build build_number:${{ inputs.build_number }} - - - name: Upload App Package Artifact - uses: actions/upload-artifact@v2 - with: - name: macos-${{ inputs.build_flavor }}-${{ github.sha }} - path: ${{ github.workspace }}/macos/LunaSea.pkg - - - name: Send Discord Message - uses: sarisia/actions-status-discord@v1 - if: always() - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - with: - title: '`[${{ inputs.build_flavor }}]` macOS Build' - description: macos-${{ inputs.build_flavor }}-${{ github.sha }} - - deploy: - name: Deploy - runs-on: macos-latest - needs: [ build ] - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Determine Release Channel - id: channel - uses: actions/github-script@v6 - env: - FLAVOR: ${{ inputs.ref }} - with: - result-encoding: string - script: | - const ref = process.env.FLAVOR || "edge"; - switch (ref) { - case "beta": return "beta"; - case "candidate": return "candidate"; - case "stable": return "stable"; - case "edge": - default: return "edge"; - } - - - name: Download App Package Artifact - uses: actions/download-artifact@v2 - with: - name: macos-${{ inputs.build_flavor }}-${{ github.sha }} - path: ${{ github.workspace }} - - - name: Install Secret Keys - working-directory: ${{ github.workspace }} - run: | - echo ${{ secrets.APPLE_STORE_CONNECT_KEY }} | base64 --decode > macos/${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }} - - - name: Install Ruby - uses: ruby/setup-ruby@v1 - with: - bundler-cache: true - - - name: Deploy to App Store Connect - working-directory: ${{ github.workspace }}/macos - env: - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }} - APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }} - APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }} - APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - run: | - bundle install - bundle exec fastlane deploy groups:${{ steps.channel.outputs.result }} pkg:${{ github.workspace }}/LunaSea.pkg diff --git a/.github/workflows/release_web.yml b/.github/workflows/release_web.yml deleted file mode 100644 index 865a75ca..00000000 --- a/.github/workflows/release_web.yml +++ /dev/null @@ -1,122 +0,0 @@ -name: '[Release] Web' - -on: - workflow_call: - inputs: - build_flavor: - required: true - type: string - build_number: - required: true - type: string - build_version: - required: true - type: string - - secrets: - DISCORD_WEBHOOK: - required: true - FIREBASE_OPTIONS: - required: true - NETLIFY_AUTH_TOKEN: - required: true - -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Download Source Files - uses: actions/download-artifact@v2 - with: - name: lib-${{ github.sha }} - path: ${{ github.workspace }}/lib - - - name: Download Localization Files - uses: actions/download-artifact@v2 - with: - name: localization-${{ github.sha }} - path: ${{ github.workspace }}/assets/localization - - - name: Install Secrets - working-directory: ${{ github.workspace }} - run: | - echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart - - - name: Install Flutter - uses: subosito/flutter-action@v2 - with: - channel: stable - cache: true - cache-key: ${{ github.sha }} - - - name: Setup Flutter - working-directory: ${{ github.workspace }} - run: | - flutter pub get - - - name: Build LunaSea - working-directory: ${{ github.workspace }} - run: | - flutter build web --web-renderer canvaskit --release - - - name: Upload Web Build Artifact - uses: actions/upload-artifact@v2 - with: - name: web-${{ inputs.build_flavor }}-${{ github.sha }} - path: ${{ github.workspace }}/build/web - - - name: Send Discord Message - uses: sarisia/actions-status-discord@v1 - if: always() - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - with: - title: '`[${{ inputs.build_flavor }}]` Web Build' - description: web-${{ inputs.build_flavor }}-${{ github.sha }} - - deploy: - name: Deploy - runs-on: ubuntu-latest - needs: [ build ] - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Determine Release Channel - id: channel - uses: actions/github-script@v6 - env: - FLAVOR: ${{ inputs.ref }} - with: - result-encoding: string - script: | - const ref = process.env.FLAVOR || "edge"; - switch (ref) { - case "beta": return "11ef2676-fc31-41b5-897b-fd21273d87ed"; - case "candidate": return "4636e6a1-17ef-45a2-a2b6-3d1c166fd1df"; - case "stable": return "6634f0b1-323c-4a2f-bd0b-8f1f388673a9"; - case "edge": - default: return "325e197e-55f4-449a-b2bb-6831fe47bf2a"; - } - - - name: Download Web Build Artifact - uses: actions/download-artifact@v2 - with: - name: web-${{ inputs.build_flavor }}-${{ github.sha }} - path: ${{ github.workspace }}/build/web - - - name: Deploy to Netlify - uses: nwtgck/actions-netlify@v1.2 - env: - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - NETLIFY_SITE_ID: ${{ steps.channel.outputs.result }} - with: - publish-dir: ${{ github.workspace}}/build/web - production-deploy: true - deploy-message: ${{ github.sha }} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index dc8cc1c4..2f464f17 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -15,9 +15,9 @@ jobs: uses: actions/checkout@v2 - name: Download Source Files - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: - name: lib-${{ github.sha }} + name: lib path: ${{ github.workspace }}/lib - name: Install Secrets diff --git a/.gitignore b/.gitignore index 16c63fe6..3da2ccf3 100644 --- a/.gitignore +++ b/.gitignore @@ -73,4 +73,11 @@ lib/firebase_options.dart # Node Dependency directories node_modules/ jspm_packages/ + +# Artifacts +output/ +*.apk +*.aab +*.ipa +*.pkg *.snap diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index f5448b25..3c772396 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -2,28 +2,47 @@ default_platform(:android) platform :android do desc "Build App Bundle" - lane :build do |options| - sh("flutter", "build", "appbundle", "--release", "--bundle-sksl-path=shaders/android_sksl.json", "--build-number=#{options[:build_number]}") + lane :build_aab do |options| + sh( + "flutter", + "build", + "appbundle", + "--release", + "--bundle-sksl-path=shaders/android_sksl.json", + "--build-number=#{options[:build_number]}", + ) + + sh("mkdir", "-p", "../../output") + sh("mv", "../../build/app/outputs/bundle/release/app-release.aab", "../../output/LunaSea-Android.aab") + end + + desc "Build APKs" + lane :build_apk do |options| + sh( + "flutter", + "build", + "apk", + "--release", + "--split-per-abi", + "--bundle-sksl-path=shaders/android_sksl.json", + "--build-number=#{options[:build_number]}", + ) + + sh("mkdir", "-p", "../../output") + sh("mv", "../../build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk", "../../output/LunaSea-Android-arm.apk") + sh("mv", "../../build/app/outputs/flutter-apk/app-arm64-v8a-release.apk", "../../output/LunaSea-Android-arm64.apk") + sh("mv", "../../build/app/outputs/flutter-apk/app-x86_64-release.apk", "../../output/LunaSea-Android-x86.apk") end desc "Deploy to Google Play Store" lane :deploy do |options| upload_to_play_store( - aab: options[:aab] || "../build/app/outputs/bundle/release/app-release.aab", + aab: options[:aab], skip_upload_metadata: true, skip_upload_images: true, skip_upload_screenshots: true, - track: options[:track] || "internal", - version_name: options[:version_name] || "Unknown Version", - ) - end - - desc "Deploy metadata changes to Google Play" - lane :metadata do - upload_to_play_store( - skip_upload_apk: true, - skip_upload_aab: true, - skip_upload_changelogs: true, + track: options[:track], + version_name: options[:version_name], ) end end diff --git a/android/fastlane/README.md b/android/fastlane/README.md index 9d3ce1bf..732a7445 100644 --- a/android/fastlane/README.md +++ b/android/fastlane/README.md @@ -15,14 +15,22 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do ## Android -### android build +### android build_aab ```sh -[bundle exec] fastlane android build +[bundle exec] fastlane android build_aab ``` Build App Bundle +### android build_apk + +```sh +[bundle exec] fastlane android build_apk +``` + +Build APKs + ### android deploy ```sh @@ -31,14 +39,6 @@ Build App Bundle Deploy to Google Play Store -### android metadata - -```sh -[bundle exec] fastlane android metadata -``` - -Deploy metadata changes to Google Play - ---- This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index fc108459..d7c4e887 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -591,7 +591,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = app.lunasea.lunasea; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea 1647811215"; + PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -729,7 +729,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = app.lunasea.lunasea; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea 1647811215"; + PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; @@ -762,7 +762,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = app.lunasea.lunasea; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match AppStore app.lunasea.lunasea 1647811233"; + PROVISIONING_PROFILE_SPECIFIER = "match AppStore app.lunasea.lunasea"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; @@ -791,7 +791,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = app.lunasea.lunasea.ImageNotification; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea.ImageNotification 1647811221"; + PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea.ImageNotification"; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -818,7 +818,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = app.lunasea.lunasea.ImageNotification; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match AppStore app.lunasea.lunasea.ImageNotification 1647811238"; + PROVISIONING_PROFILE_SPECIFIER = "match AppStore app.lunasea.lunasea.ImageNotification"; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; }; @@ -845,7 +845,7 @@ MTL_FAST_MATH = YES; PRODUCT_BUNDLE_IDENTIFIER = app.lunasea.lunasea.ImageNotification; PRODUCT_NAME = "$(TARGET_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea.ImageNotification 1647811221"; + PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea.ImageNotification"; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; }; diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 292d1895..d3229d65 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -54,6 +54,8 @@ platform :ios do "app.lunasea.lunasea.ImageNotification" => "Provisioning Profile Name 2" }, ) + sh("mkdir", "-p", "../../output") + sh("mv", "../../ios/Runner.ipa", "../../output/LunaSea-iOS.ipa") destroy_keychain end @@ -69,8 +71,8 @@ platform :ios do upload_to_testflight( changelog: "Thank you for testing pre-release builds of LunaSea! Please consider joining the Discord to give feedback to the developer.\n\nChanges can be found on GitHub or by going to settings/system and tapping on the version tile!", distribute_external: true, - groups: options[:groups] || "internal", - ipa: options[:ipa] || "../ios/Runner.ipa", + groups: options[:groups], + ipa: options[:ipa], notify_external_testers: true, ) end diff --git a/ios/fastlane/Matchfile b/ios/fastlane/Matchfile index 1b6586fe..3b6b5b57 100644 --- a/ios/fastlane/Matchfile +++ b/ios/fastlane/Matchfile @@ -1,5 +1,4 @@ git_url("git@github.com:JagandeepBrar/LunaSea-Fastlane-Storage.git") storage_mode("git") -type("appstore") app_identifier(["app.lunasea.lunasea", "app.lunasea.lunasea.ImageNotification"]) platform("ios") diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 8e253ec2..c50d503b 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -445,7 +445,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea macos 1647811089"; + PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea macos"; SWIFT_VERSION = 5.0; }; name = Profile; @@ -574,7 +574,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea macos 1647811089"; + PROVISIONING_PROFILE_SPECIFIER = "match Development app.lunasea.lunasea macos"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; SWIFT_VERSION = 5.0; }; @@ -597,7 +597,7 @@ "$(inherited)", "@executable_path/../Frameworks", ); - PROVISIONING_PROFILE_SPECIFIER = "match AppStore app.lunasea.lunasea macos 1647811108"; + PROVISIONING_PROFILE_SPECIFIER = "match AppStore app.lunasea.lunasea macos"; SWIFT_VERSION = 5.0; }; name = Release; diff --git a/macos/fastlane/Fastfile b/macos/fastlane/Fastfile index c497e637..1ef72524 100644 --- a/macos/fastlane/Fastfile +++ b/macos/fastlane/Fastfile @@ -51,6 +51,8 @@ platform :mac do workspace: "Runner.xcworkspace", export_method: "app-store", ) + sh("mkdir", "-p", "../../output") + sh("mv", "../../macos/LunaSea.pkg", "../../output/LunaSea-macOS.pkg") destroy_keychain end @@ -66,8 +68,8 @@ platform :mac do upload_to_testflight( changelog: "Thank you for testing pre-release builds of LunaSea! Please consider joining the Discord to give feedback to the developer.\n\nChanges can be found on GitHub or by going to settings/system and tapping on the version tile!", distribute_external: true, - groups: options[:groups] || "internal", - pkg: options[:pkg] || "../macos/LunaSea.pkg", + groups: options[:groups], + pkg: options[:pkg], notify_external_testers: true, ) end diff --git a/macos/fastlane/Matchfile b/macos/fastlane/Matchfile index 64503f4f..099b9b4e 100644 --- a/macos/fastlane/Matchfile +++ b/macos/fastlane/Matchfile @@ -1,5 +1,4 @@ git_url("git@github.com:JagandeepBrar/LunaSea-Fastlane-Storage.git") storage_mode("git") -type("appstore") app_identifier("app.lunasea.lunasea") platform("macos")