diff --git a/.github/workflows/beta_version.yml b/.github/workflows/beta_version.yml index 69842dcc..679d4bb7 100644 --- a/.github/workflows/beta_version.yml +++ b/.github/workflows/beta_version.yml @@ -1,22 +1,21 @@ -name: 'publish beta' +name: '๐Ÿงช and ๐Ÿ“ข and ๐Ÿ“ฒ' on: - workflow_dispatch: - inputs: - platform: - description: 'Select platform(s) to build' - required: true - default: 'both' - type: choice - options: - - android - - ios - - both + push: + branches: ['stable'] jobs: - distribute_android: - if: ${{ github.event.inputs.platform == 'android' || github.event.inputs.platform == 'both' }} + tests: + uses: ./.github/workflows/test.yml + with: + backend-url: http://localhost:8090 + user-email: ${{ vars.USER_EMAIL }} + user-password: ${{ vars.USER_PASSWORD }} + user-seed: ${{ vars.USER_SEED }} + + distribute: uses: ./.github/workflows/distribute.yml + needs: tests with: backend-url: ${{ vars.PUBLIC_BACKEND_URL }} lane: beta @@ -26,56 +25,3 @@ jobs: keystore-alias: ${{ secrets.BUNDLE_BETA_PLAYSTORE_ALIAS }} keystore-password: ${{ secrets.BUNDLE_BETA_PASSWORD }} keystore-key-password: ${{ secrets.BUNDLE_BETA_PASSWORD }} - - distribute_ios: - runs-on: macOS-latest - environment: ios - if: ${{ github.event.inputs.platform == 'ios' || github.event.inputs.platform == 'both' }} - steps: - - uses: dyne/pnpm@main - with: - node-version: '20.11.1' - submodules: true - - name: Set env - run: echo "PUBLIC_BACKEND_URL=${{vars.PUBLIC_BACKEND_URL}}" >> $GITHUB_ENV - - name: Install dependencies - id: install_code - run: pnpm install - - name: Build - id: build_code - run: pnpm build - - uses: actions/cache@v3 - with: - path: ios/App/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} - restore-keys: | - ${{ runner.os }}-pods- - - name: Sync - id: sync_code - run: pnpm cap sync ios - - uses: ruby/setup-ruby@v1 - with: - ruby-version: '3.0' - bundler-cache: true - - uses: maierj/fastlane-action@v3.1.0 - env: - APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }} - BUNDLE_IDENTIFIER: ${{ secrets.BUNDLE_IDENTIFIER }} - BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_BUILD_CERTIFICATE }} - BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.IOS_BUILD_PROVISION_PROFILE }} - APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }} - APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }} - APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }} - APPLE_PROFILE_NAME: ${{ secrets.APPLE_PROFILE_NAME }} - P12_PASSWORD: ${{ secrets.P12_PASSWORD }} - DEMO_USER: ${{ vars.USER_EMAIL }} - DEMO_PASSWORD: ${{ vars.USER_PASSWORD }} - with: - lane: ios production - - name: Upload release bundle - uses: actions/upload-artifact@v4 - with: - name: ios-release - path: ./App.ipa - retention-days: 10 - \ No newline at end of file diff --git a/.github/workflows/publish_on_production.yml b/.github/workflows/publish_on_production.yml new file mode 100644 index 00000000..dfab283c --- /dev/null +++ b/.github/workflows/publish_on_production.yml @@ -0,0 +1,80 @@ +name: 'publish on production' + +on: + workflow_dispatch: + inputs: + platform: + description: 'Select platform(s) to build' + required: true + default: 'both' + type: choice + options: + - android + - ios + - both + +jobs: + distribute_android: + if: ${{ github.ref == 'refs/heads/stable'&&(github.event.inputs.platform == 'android' || github.event.inputs.platform == 'both') }} + uses: ./.github/workflows/distribute.yml + with: + backend-url: ${{ vars.PUBLIC_BACKEND_URL }} + lane: production + secrets: + keystore-file: ${{ secrets.BUNDLE_BETA_PLAYSTORE }} + service-account: ${{ secrets.PLAYSTORE_SERVICE_ACCOUNT }} + keystore-alias: ${{ secrets.BUNDLE_BETA_PLAYSTORE_ALIAS }} + keystore-password: ${{ secrets.BUNDLE_BETA_PASSWORD }} + keystore-key-password: ${{ secrets.BUNDLE_BETA_PASSWORD }} + + distribute_ios: + runs-on: macOS-latest + environment: ios + if: ${{ github.ref == 'refs/heads/stable'&&(github.event.inputs.platform == 'ios' || github.event.inputs.platform == 'both') }} + steps: + - uses: dyne/pnpm@main + with: + node-version: '20.11.1' + submodules: true + - name: Set env + run: echo "PUBLIC_BACKEND_URL=${{vars.PUBLIC_BACKEND_URL}}" >> $GITHUB_ENV + - name: Install dependencies + id: install_code + run: pnpm install + - name: Build + id: build_code + run: pnpm build + - uses: actions/cache@v3 + with: + path: ios/App/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + - name: Sync + id: sync_code + run: pnpm cap sync ios + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.0' + bundler-cache: true + - uses: maierj/fastlane-action@v3.1.0 + env: + APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }} + BUNDLE_IDENTIFIER: ${{ secrets.BUNDLE_IDENTIFIER }} + BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_BUILD_CERTIFICATE }} + BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.IOS_BUILD_PROVISION_PROFILE }} + APPLE_KEY_ID: ${{ secrets.APPLE_KEY_ID }} + APPLE_ISSUER_ID: ${{ secrets.APPLE_ISSUER_ID }} + APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }} + APPLE_PROFILE_NAME: ${{ secrets.APPLE_PROFILE_NAME }} + P12_PASSWORD: ${{ secrets.P12_PASSWORD }} + DEMO_USER: ${{ vars.USER_EMAIL }} + DEMO_PASSWORD: ${{ vars.USER_PASSWORD }} + with: + lane: ios production + - name: Upload release bundle + uses: actions/upload-artifact@v4 + with: + name: ios-release + path: ./App.ipa + retention-days: 10 diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 805b14d2..20dd5263 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -63,15 +63,25 @@ platform :android do ) end - private_lane :update_version do |version_code, version_name| - package = load_json(json_path: "./package.json") + private_lane :update_version do |options| increment_version_code( gradle_file_path: "./android/app/build.gradle", - version_code: version_code + version_code: options[:version_code] ) increment_version_name( gradle_file_path: "./android/app/build.gradle", - version_name: version_name + version_name: options[:version_name] + ) + end + + private_lane :deliver_to_play_store do |options| + upload_to_play_store( + json_key:"#{SERVICE_ACCOUNT_PATH}", + package_name:"com.didroom.wallet", + aab:"android/app/build/outputs/bundle/release/app-release.aab", + track: options[:track], + metadata_path: "./fastlane/metadata/android", + skip_upload_apk: true, ) end @@ -79,28 +89,22 @@ platform :android do lane :github do build_and_sync package = load_json(json_path: "./package.json") - increment_version_code( - gradle_file_path: "./android/app/build.gradle", - version_code: package['version'].gsub('.', '').to_i - ) - increment_version_name( - gradle_file_path: "./android/app/build.gradle", - version_name: package['version'] - ) + update_version(version_code: package['version'].gsub('.', '').to_i, version_name: package['version']) sign_and_build_bundle end lane :distribute do build_and_sync package = load_json(json_path: "./package.json") - increment_version_code( - gradle_file_path: "./android/app/build.gradle", - version_code: PULL_REQUEST_NUMBER - ) - increment_version_name( - gradle_file_path: "./android/app/build.gradle", - version_name: package['version'] + "-" + PULL_REQUEST_NUMBER - ) + # increment_version_code( + # gradle_file_path: "./android/app/build.gradle", + # version_code: PULL_REQUEST_NUMBER + # ) + # increment_version_name( + # gradle_file_path: "./android/app/build.gradle", + # version_name: package['version'] + "-" + PULL_REQUEST_NUMBER + # ) + update_version(version_code: PULL_REQUEST_NUMBER, version_name: package['version'] + "-" + PULL_REQUEST_NUMBER) sign_and_build_bundle release = firebase_app_distribution( app: FIREBASE_APP_ID, @@ -112,7 +116,6 @@ platform :android do end lane :alpha do - sh "echo #{PUBLIC_BACKEND_URL}" build_and_sync package = load_json(json_path: "./package.json") internal_latest_version_code = google_play_track_version_codes( @@ -120,27 +123,20 @@ platform :android do json_key:"#{SERVICE_ACCOUNT_PATH}", package_name:"com.didroom.wallet" ) - increment_version_code( - gradle_file_path: "./android/app/build.gradle", - version_code: internal_latest_version_code.max + 1 - ) - increment_version_name( - gradle_file_path: "./android/app/build.gradle", - version_name: package['version'] + "-alpha" - ) + # increment_version_code( + # gradle_file_path: "./android/app/build.gradle", + # version_code: internal_latest_version_code.max + 1 + # ) + # increment_version_name( + # gradle_file_path: "./android/app/build.gradle", + # version_name: package['version'] + "-alpha" + # ) + update_version(version_code: internal_latest_version_code.max + 1, version_name: package['version'] + "-alpha") sign_and_build_bundle - release = upload_to_play_store( - json_key:"#{SERVICE_ACCOUNT_PATH}", - package_name:"com.didroom.wallet", - aab:"android/app/build/outputs/bundle/release/app-release.aab", - track: 'alpha', - metadata_path: "./fastlane/metadata/android", - skip_upload_apk: true, - ) + release = deliver_to_play_store(track: 'alpha') end lane :beta do - sh "echo #{PUBLIC_BACKEND_URL}" build_and_sync package = load_json(json_path: "./package.json") internal_latest_version_code = google_play_track_version_codes( @@ -148,24 +144,24 @@ platform :android do json_key:"#{SERVICE_ACCOUNT_PATH}", package_name:"com.didroom.wallet" ) - increment_version_code( - gradle_file_path: "./android/app/build.gradle", - version_code: internal_latest_version_code.max + 1 - ) - increment_version_name( - gradle_file_path: "./android/app/build.gradle", - version_name: package['version'] + "-beta" - ) + update_version(version_code: internal_latest_version_code.max + 1, version_name: package['version'] + "-beta") sign_and_build_bundle - release = upload_to_play_store( + release = deliver_to_play_store(track: 'beta') + end + + lane :production do + build_and_sync + package = load_json(json_path: "./package.json") + internal_latest_version_code = google_play_track_version_codes( + track: 'production', json_key:"#{SERVICE_ACCOUNT_PATH}", - package_name:"com.didroom.wallet", - aab:"android/app/build/outputs/bundle/release/app-release.aab", - track: 'beta', - metadata_path: "./fastlane/metadata/android", - skip_upload_apk: true, + package_name:"com.didroom.wallet" ) + update_version(version_code: internal_latest_version_code.max + 1, version_name: package['version']) + sign_and_build_bundle + release = deliver_to_play_store(track: 'production') end + end