From 7e03f6960596288d8be1fa9915db761047f8b39f Mon Sep 17 00:00:00 2001 From: richardo2016x Date: Mon, 13 May 2024 13:05:44 +0800 Subject: [PATCH] ci: support distribute ios appstore on ci. --- .github/workflows/android_alpha.yml | 111 ------------------ .github/workflows/android_release.yml | 2 +- .../{ios_alpha.yml => ios_release.yml} | 44 ++++--- 3 files changed, 30 insertions(+), 127 deletions(-) delete mode 100644 .github/workflows/android_alpha.yml rename .github/workflows/{ios_alpha.yml => ios_release.yml} (84%) diff --git a/.github/workflows/android_alpha.yml b/.github/workflows/android_alpha.yml deleted file mode 100644 index 032b76b92..000000000 --- a/.github/workflows/android_alpha.yml +++ /dev/null @@ -1,111 +0,0 @@ -name: Build and deploy Android alpha -on: - push: - tags: - - 'android-alpha-*' - branches: - - 'ci/android-alpha-*' - - ci/* - workflow_call: - secrets: - RABBY_MOBILE_ANDROID_KEY_STORE: - required: true - RABBY_MOBILE_ANDROID_KEY_PASSWORD: - required: true - RABBY_MOBILE_ANDROID_KEY_ALIAS: - required: true - RABBY_MOBILE_KR_PWD: - required: true - -# defaults: -# run: -# shell: bash -ieo pipefail {0} -env: - BUILD_TARGET_PLATFORM: android - -jobs: - alpha-build: - name: android-alpha-build - runs-on: - - self-hosted - - mobile - - macOS - steps: - - uses: actions/checkout@v3 - - name: Get Actions Variables - id: actionvars - shell: bash - run: | - trigger_date=$(date +'%Y%m%d%H%M%S') - echo "trigger_date=$trigger_date" >> "$GITHUB_OUTPUT" - - flatten_refname=${GITHUB_REF_NAME//\//'_'} - flatten_refname=${flatten_refname//\./'_'} - echo "flatten_refname=$flatten_refname" >> "$GITHUB_OUTPUT" - # env: - # GITHUB_REF_NAME: ${{ github.ref_name }} - - # - name: Setup Nodejs and Yarn - # uses: actions/setup-node@v3 - # with: - # node-version: 18 - - # - name: Setup Ruby & Fastlane - # uses: ruby/setup-ruby@v1 - # with: - # ruby-version: '2.7' - # bundler-cache: true # runs 'bundle install' and caches installed gems automatically - - - name: Setup Java - uses: actions/setup-java@v3 - with: - distribution: 'zulu' # See 'Supported distributions' for available options - java-version: '17' - - - name: Setup Android SDK - uses: android-actions/setup-android@v2 - - - name: Setup & Install dependencies - run: | - yarn --version; - # yarn setup && yarn postinstall; - yarn install; - cd apps/mobile; - bundle install; - env: - FLATTEN_REFNAME: ${{ steps.actionvars.outputs.flatten_refname }} - TRIGGER_DATE: ${{ steps.actionvars.outputs.trigger_date }} - - - name: Build app - env: - RABBY_MOBILE_BUILD_BUCKET: ${{ secrets.RABBY_MOBILE_BUILD_BUCKET }} - RABBY_MOBILE_KR_PWD: ${{ secrets.RABBY_MOBILE_KR_PWD }} - RABBY_MOBILE_ANDROID_KEY_STORE: ${{ secrets.RABBY_MOBILE_ANDROID_KEY_STORE }} - RABBY_MOBILE_ANDROID_KEY_PASSWORD: ${{ secrets.RABBY_MOBILE_ANDROID_KEY_PASSWORD }} - RABBY_MOBILE_ANDROID_KEY_ALIAS: ${{ secrets.RABBY_MOBILE_ANDROID_KEY_ALIAS }} - RABBY_MOBILE_SENTRY_AUTH_TOKEN2: ${{ secrets.RABBY_MOBILE_SENTRY_AUTH_TOKEN2 }} - SENTRY_AUTH_TOKEN: ${{ secrets.RABBY_MOBILE_SENTRY_AUTH_TOKEN2 }} - LARK_CHAT_URL: ${{ secrets.LARK_CHAT_URL }} - LARK_CHAT_SECRET: ${{ secrets.LARK_CHAT_SECRET }} - RABBY_ROBOT_LARK_APP_ID: ${{ secrets.RABBY_ROBOT_LARK_APP_ID }} - RABBY_ROBOT_LARK_APP_SECRET: ${{ secrets.RABBY_ROBOT_LARK_APP_SECRET }} - # see more details on https://docs.github.com/en/actions/learn-github-actions/contexts#github-context - GIT_ACTIONS_JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - GITHUB_ACTOR: ${{ github.actor }} - GITHUB_TRIGGERING_ACTOR: ${{ github.triggering_actor }} - GIT_COMMIT_URL: ${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }} - GIT_REF_NAME: ${{ github.ref_name }} - GIT_REF_URL: ${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }} - GITHUB_REF: ${{ github.ref }} - run: | - cd apps/mobile; - yarn prepare-archive; - buildchannel=selfhost-reg REALLY_UPLOAD=true ./scripts/deploy-android.sh - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: rabbymobile-${{ steps.actionvars.outputs.flatten_refname }}-${{ steps.actionvars.outputs.trigger_date }} - path: | - ./apps/mobile/android/app/build/outputs/apk/release/app-release.apk - retention-days: 90 diff --git a/.github/workflows/android_release.yml b/.github/workflows/android_release.yml index f6de041da..3035b7d99 100644 --- a/.github/workflows/android_release.yml +++ b/.github/workflows/android_release.yml @@ -5,7 +5,7 @@ on: - 'android-release-*' branches: - 'ci/android-release-*' - - ci/* + - ci/universal-release-* workflow_dispatch: inputs: buildchannel: diff --git a/.github/workflows/ios_alpha.yml b/.github/workflows/ios_release.yml similarity index 84% rename from .github/workflows/ios_alpha.yml rename to .github/workflows/ios_release.yml index 2fba4588b..817b9eb55 100644 --- a/.github/workflows/ios_alpha.yml +++ b/.github/workflows/ios_release.yml @@ -1,11 +1,21 @@ -name: Build and deploy iOS alpha +name: Build and deploy iOS release on: push: tags: - - 'ios-alpha-*' + - 'ios-release-*' branches: - - 'ci/ios-alpha-*' - - ci/* + - 'ci/ios-release-*' + - ci/universal-release-* + workflow_dispatch: + inputs: + REALLY_UPLOAD: + required: true + type: boolean + default: true + SENTRY_DISABLE_AUTO_UPLOAD: + required: true + type: boolean + default: true workflow_call: secrets: KEYCHAIN_PASS: @@ -20,7 +30,7 @@ env: jobs: setup: - name: iOS-alpha-build + name: iOS-release-build runs-on: [self-hosted, mobile, macOS] steps: - uses: actions/checkout@v4 @@ -53,21 +63,34 @@ jobs: xcode-version: '15.3' - name: Install dependencies + shell: bash run: | yarn --version; cd ./apps/mobile; yarn install; - name: Build app + shell: bash + run: | + yarn prepare-archive; + + # security unlock-keychain -p ${{ secrets.KEYCHAIN_PASS }} ~/Library/Keychains/login.keychain-db + security unlock-keychain -p ${{ secrets.KEYCHAIN_PASS }} login.keychain + cd ios && bundle install && bundle exec pod install; + cd ../; + ./scripts/deploy-ios-adhoc.sh + env: KEYCHAIN_PASS: ${{ secrets.KEYCHAIN_PASS }} RABBY_MOBILE_BUILD_BUCKET: ${{ secrets.RABBY_MOBILE_BUILD_BUCKET }} RABBY_MOBILE_KR_PWD: ${{ secrets.RABBY_MOBILE_KR_PWD }} RABBY_MOBILE_SENTRY_AUTH_TOKEN2: ${{ secrets.RABBY_MOBILE_SENTRY_AUTH_TOKEN2 }} SENTRY_AUTH_TOKEN: ${{ secrets.RABBY_MOBILE_SENTRY_AUTH_TOKEN2 }} + REALLY_UPLOAD: ${{ inputs.REALLY_UPLOAD }} + SENTRY_DISABLE_AUTO_UPLOAD: ${{ inputs.SENTRY_DISABLE_AUTO_UPLOAD }} CONFIGURATION: release TYPE: adhoc - BUILD_ENV: alpha + BUILD_ENV: release LARK_CHAT_URL: ${{ secrets.LARK_CHAT_URL }} LARK_CHAT_SECRET: ${{ secrets.LARK_CHAT_SECRET }} RABBY_ROBOT_LARK_APP_ID: ${{ secrets.RABBY_ROBOT_LARK_APP_ID }} @@ -80,15 +103,6 @@ jobs: GIT_REF_NAME: ${{ github.ref_name }} GIT_REF_URL: ${{ github.server_url }}/${{ github.repository }}/tree/${{ github.ref_name }} GITHUB_REF: ${{ github.ref }} - run: | - cd apps/mobile; - yarn prepare-archive; - - # security unlock-keychain -p ${{ secrets.KEYCHAIN_PASS }} ~/Library/Keychains/login.keychain-db - security unlock-keychain -p ${{ secrets.KEYCHAIN_PASS }} login.keychain - cd ios && bundle install && bundle exec pod install; - cd ../; - REALLY_UPLOAD=true ./scripts/deploy-ios-adhoc.sh - name: Upload artifact uses: actions/upload-artifact@v3