fix(ci): fix bump version issue #25
Workflow file for this run
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: Release Workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
version_type: | |
description: "Type of version bump (major, minor, patch, premajor, preminor, prepatch, prerelease)" | |
required: true | |
default: "patch" | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
- premajor | |
- preminor | |
- prepatch | |
- prerelease | |
push: | |
branches: | |
- ci/test | |
paths-ignore: # Don't trigger on version-related files | |
- '.version' | |
- 'package.json' | |
- 'android/app/build.gradle' | |
- 'ios/**/Info.plist' | |
jobs: | |
# Job 1: Version Bumping and Android Build | |
build_android: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: 'write' # Allows workflow to checkout repository code | |
id-token: 'write' # Required for Google Cloud Workload Identity Federation authentication (OIDC token generation) | |
steps: | |
# Step 1: Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.18.0' # Use the specified Node.js version | |
cache: 'yarn' | |
# Step 3: Install dependencies using Yarn | |
- name: Install dependencies | |
run: yarn install | |
# Step 4: Set up Ruby and Bundler | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2.3' # Specify a Ruby version | |
bundler-cache: true | |
# Step 5: Bump Android version | |
- name: Bump Android version | |
working-directory: ${{ github.workspace }} | |
run: bundle exec fastlane bump_version_android version_type:${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type || 'patch' }} | |
# Step 6: Commit and push Android version changes | |
- name: Commit and push Android version changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add .version package.json android/app/build.gradle | |
git commit -m "Bump Android version to $(cat .version)" | |
git push | |
# Step 7: Set up Android Keystore | |
- name: Set up Android Keystore | |
run: | | |
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > android/keystore.jks | |
# Step 8: Authenticate to Google Cloud | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }} | |
# Step 9: Build and upload Android app to Alpha track | |
- name: Build and upload Android app | |
working-directory: android | |
env: | |
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} | |
KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
GRADLE_USER_HOME: ${{ runner.temp }}/.gradle | |
run: bundle exec fastlane release_android_alpha | |
# Step 10: Upload the entire project directory for use in the iOS job | |
# - name: Upload code for iOS build | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: source-code | |
# path: . | |
# retention-days: 1 | |
# Job 2: iOS Build and Upload (runs on macOS) | |
build_ios: | |
runs-on: macos-latest | |
needs: build_android | |
steps: | |
- name: Checkout code # Replace the Download code step | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} # This ensures we get the latest changes including the version bump | |
# steps: | |
# # Step 1: Download code from previous job | |
# - name: Download code | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: source-code | |
# path: . | |
# Step 2: Set up Node.js | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20.18.0' | |
cache: 'yarn' | |
# Step 3: Install dependencies using Yarn | |
- name: Install dependencies | |
run: yarn install | |
# Step 4: Set up Ruby and Bundler | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2.3' # Specify a Ruby version | |
bundler-cache: true | |
# Step 5: Install CocoaPods dependencies | |
- name: Install CocoaPods dependencies | |
working-directory: ios | |
run: pod install | |
# Step 6: Bump iOS version | |
- name: Bump iOS version | |
working-directory: ${{ github.workspace }} | |
run: bundle exec fastlane bump_version_ios | |
# Step 7: Commit, push, and tag iOS version changes | |
- name: Commit, push, and tag iOS version changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git add ios/**/Info.plist | |
git commit -m "Bump iOS version to $(cat .version)" | |
git push | |
git tag "v$(cat .version)" | |
git push origin "v$(cat .version)" | |
# Step 8: Build and upload iOS app to TestFlight | |
- name: Build and upload iOS app | |
working-directory: ios | |
env: | |
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }} | |
APP_STORE_CONNECT_API_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ID }} | |
APP_STORE_CONNECT_API_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_ISSUER_ID }} | |
APP_STORE_CONNECT_API_KEY_CONTENT: ${{ secrets.APP_STORE_CONNECT_API_KEY_CONTENT }} | |
run: bundle exec fastlane release_ios |