Skip to content

Commit

Permalink
feat: publish production version on play store
Browse files Browse the repository at this point in the history
  • Loading branch information
phoebus-84 committed Dec 5, 2024
1 parent faf9d3e commit dacbac3
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 119 deletions.
80 changes: 13 additions & 67 deletions .github/workflows/beta_version.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/[email protected]
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

80 changes: 80 additions & 0 deletions .github/workflows/publish_on_production.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
100 changes: 48 additions & 52 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,44 +63,48 @@ 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

desc "Deploy GitHub version"
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,
Expand All @@ -112,60 +116,52 @@ 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(
track: 'alpha',
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(
track: 'beta',
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


Expand Down

0 comments on commit dacbac3

Please sign in to comment.