-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Update Fastlane & Sync More Directories (#28)
- Loading branch information
Showing
83 changed files
with
1,548 additions
and
934 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,134 @@ | ||
name: Sync CMP Directories | ||
on: | ||
# Manual trigger | ||
workflow_dispatch: | ||
# Run weekly on Monday at 00:00 UTC | ||
schedule: | ||
- cron: '0 0 * * 1' | ||
|
||
jobs: | ||
sync-directories: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: dev | ||
|
||
- name: Setup Git config | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
- name: Add upstream remote | ||
- name: Add upstream remote and fetch | ||
run: | | ||
git remote add upstream https://github.com/openMF/kmp-project-template.git || true | ||
git fetch upstream | ||
git fetch upstream || exit 1 | ||
- name: Create temporary branch | ||
- name: Check upstream/dev exists | ||
run: | | ||
if ! git rev-parse --verify upstream/dev >/dev/null 2>&1; then | ||
echo "Error: upstream/dev branch does not exist" | ||
exit 1 | ||
fi | ||
- name: Create and checkout temporary branch | ||
run: | | ||
TEMP_BRANCH="temp-sync-branch-${{ github.run_number }}" | ||
git checkout -b $TEMP_BRANCH upstream/dev | ||
git checkout -b "$TEMP_BRANCH" upstream/dev || exit 1 | ||
echo "TEMP_BRANCH=$TEMP_BRANCH" >> $GITHUB_ENV | ||
- name: Sync CMP directories | ||
- name: Sync directories | ||
run: | | ||
DIRS=("cmp-android" "cmp-desktop" "cmp-ios" "cmp-web") | ||
DIRS=( | ||
"cmp-android" | ||
"cmp-desktop" | ||
"cmp-ios" | ||
"cmp-web" | ||
"cmp-shared" | ||
"build-logic" | ||
"fastlane" | ||
"scripts" | ||
"config" | ||
".github" | ||
".run" | ||
) | ||
FILES=( | ||
"Gemfile" | ||
"Gemfile.lock" | ||
"ci-prepush.bat" | ||
"ci-prepush.sh" | ||
) | ||
git checkout dev | ||
# Sync directories | ||
for dir in "${DIRS[@]}"; do | ||
if [ -d "$dir" ]; then | ||
echo "Syncing $dir..." | ||
else | ||
if [ ! -d "$dir" ]; then | ||
echo "Creating $dir..." | ||
mkdir -p "$dir" | ||
fi | ||
git checkout temp-sync-branch-${{ github.run_number }} -- "$dir" | ||
echo "Syncing $dir..." | ||
git checkout "${{ env.TEMP_BRANCH }}" -- "$dir" || exit 1 | ||
done | ||
# Sync files | ||
for file in "${FILES[@]}"; do | ||
echo "Syncing $file..." | ||
git checkout "${{ env.TEMP_BRANCH }}" -- "$file" || true | ||
done | ||
- name: Clean up temporary branch | ||
run: | | ||
git branch -D temp-sync-branch-${{ github.run_number }} | ||
if: always() | ||
run: git branch -D "${{ env.TEMP_BRANCH }}" || true | ||
|
||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
if [[ -n "$(git status --porcelain)" ]]; then | ||
echo "Has changes to commit" | ||
echo "has_changes=true" >> $GITHUB_OUTPUT | ||
else | ||
echo "No changes to commit" | ||
echo "has_changes=false" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Commit and push changes | ||
if: steps.check_changes.outputs.has_changes == 'true' | ||
run: | | ||
git add cmp-android cmp-desktop cmp-ios cmp-web | ||
git commit -m "chore: Sync CMP directories from upstream | ||
Automated sync of CMP directories: | ||
- cmp-android | ||
- cmp-desktop | ||
- cmp-ios | ||
- cmp-web | ||
Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
git push origin dev | ||
- name: Create Pull Request | ||
if: steps.check_changes.outputs.has_changes == 'true' | ||
uses: peter-evans/create-pull-request@v7 | ||
with: | ||
committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | ||
author: ${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com> | ||
title: "chore: Sync CMP directories from upstream" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: "chore: Sync directories and files from upstream" | ||
title: "chore: Sync directories and files from upstream" | ||
body: | | ||
Automated sync of CMP directories from upstream repository. | ||
Automated sync of directories and files from upstream repository. | ||
Changes included in this sync: | ||
Directories: | ||
- cmp-android | ||
- cmp-desktop | ||
- cmp-ios | ||
- cmp-web | ||
- build-logic | ||
- fastlane | ||
- scripts | ||
- config | ||
- .github | ||
- .run | ||
Please review the changes and merge if everything looks correct. | ||
Files: | ||
- Gemfile | ||
- Gemfile.lock | ||
- ci-prepush.bat | ||
- ci-prepush.sh | ||
Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
branch: sync-cmp-dirs | ||
commit-message: "chore: Sync CMP directories from upstream" | ||
branch: sync-dirs-${{ github.run_number }} | ||
delete-branch: true | ||
labels: | | ||
sync | ||
automated pr | ||
automated pr | ||
base: dev |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
# Fastlane Configuration | ||
|
||
This repository contains Fastlane configuration for automating iOS and Android app deployment processes. The setup includes support for Firebase App Distribution, Google Play Store deployment, and automated versioning. | ||
|
||
## Prerequisites | ||
|
||
- Ruby version 2.5 or higher | ||
- Fastlane installed (`gem install fastlane`) | ||
- Firebase CLI (for Firebase deployments) | ||
- Google Play Console access (for Android Play Store deployments) | ||
- Apple Developer account (for iOS deployments) | ||
|
||
## Setup | ||
|
||
1. Clone the repository | ||
2. Install dependencies: | ||
```bash | ||
bundle install | ||
``` | ||
3. Set up your environment variables or update your platform configurations in `fastlane-config/` directory. | ||
|
||
## Configuration | ||
|
||
### Environment Variables | ||
|
||
The following environment variables can be set to override default configurations: | ||
|
||
#### Android | ||
```bash | ||
ANDROID_STORE_FILE="path/to/keystore" | ||
ANDROID_STORE_PASSWORD="your_store_password" | ||
ANDROID_KEY_ALIAS="your_key_alias" | ||
ANDROID_KEY_PASSWORD="your_key_password" | ||
FIREBASE_ANDROID_APP_ID="your_firebase_app_id" | ||
``` | ||
|
||
#### iOS | ||
```bash | ||
FIREBASE_IOS_APP_ID="your_firebase_app_id" | ||
``` | ||
|
||
#### Common | ||
```bash | ||
FIREBASE_SERVICE_CREDS_FILE="path/to/service/creds.json" | ||
FIREBASE_GROUPS="your_test_groups" | ||
``` | ||
|
||
### Configuration File | ||
|
||
The `fastlane-config` directory contains default configurations for each platform that can be overridden by environment variables or lane parameters. Update these files with your project-specific values. | ||
|
||
## Available Lanes | ||
|
||
### Android Lanes | ||
|
||
```bash | ||
# Build debug APK | ||
fastlane android assembleDebugApks | ||
|
||
# Build release APK | ||
fastlane android assembleReleaseApks | ||
# Optional params: store_file, store_password, key_alias, key_password | ||
|
||
# Deploy to Firebase App Distribution | ||
fastlane android deployReleaseApkOnFirebase | ||
# Optional params: store_file, store_password, key_alias, key_password | ||
|
||
# Deploy demo build to Firebase | ||
fastlane android deployDemoApkOnFirebase | ||
|
||
# Deploy to Play Store internal track | ||
fastlane android deployInternal | ||
|
||
# Generate version number | ||
fastlane android generateVersion | ||
# Optional param: platform (git|firebase|playstore) | ||
|
||
# Generate release notes | ||
fastlane android generateReleaseNote | ||
|
||
# Generate full release notes | ||
fastlane android generateFullReleaseNote | ||
# Optional param: fromTag | ||
``` | ||
|
||
### iOS Lanes | ||
|
||
```bash | ||
# Build iOS app | ||
fastlane ios build_ios | ||
# Optional param: configuration (Debug|Release) | ||
|
||
# Deploy to Firebase | ||
fastlane ios deploy_on_firebase | ||
|
||
# Increment version | ||
fastlane ios increment_version | ||
``` | ||
|
||
## Version Generation | ||
|
||
The system supports three versioning strategies: | ||
|
||
1. **Git-based**: Uses commit count (`git`) | ||
2. **Firebase-based**: Increments from last Firebase version (`firebase`) | ||
3. **Play Store-based**: Increments from last Play Store version (`playstore`) | ||
|
||
## Release Notes Generation | ||
|
||
Two types of release notes can be generated: | ||
|
||
1. **Simple**: Latest commit message | ||
```bash | ||
fastlane android generateReleaseNote | ||
``` | ||
|
||
2. **Full**: Categorized changes since last tag | ||
```bash | ||
fastlane android generateFullReleaseNote | ||
``` | ||
|
||
## CI/CD Integration | ||
|
||
### GitHub Actions Example | ||
```yaml | ||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Deploy to Firebase | ||
env: | ||
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }} | ||
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} | ||
run: | | ||
fastlane android deployReleaseApkOnFirebase | ||
``` | ||
### GitLab CI Example | ||
```yaml | ||
deploy_firebase: | ||
script: | ||
- fastlane android deployReleaseApkOnFirebase | ||
variables: | ||
ANDROID_STORE_PASSWORD: ${ANDROID_STORE_PASSWORD} | ||
ANDROID_KEY_PASSWORD: ${ANDROID_KEY_PASSWORD} | ||
``` | ||
## Best Practices | ||
1. Never commit sensitive data (passwords, keys) to version control | ||
2. Use environment variables for sensitive data in CI/CD | ||
3. Keep the `fastlane-config` directory files updated with latest configurations | ||
4. Regularly update Fastlane and its plugins | ||
5. Test deployment scripts in a staging environment first | ||
|
||
## Troubleshooting | ||
|
||
Common issues and solutions: | ||
|
||
1. **Keystore not found** | ||
- Ensure keystore path is correct in config or environment variable | ||
- Verify keystore file exists in the specified location | ||
|
||
2. **Firebase deployment fails** | ||
- Check Firebase service credentials file exists and is valid | ||
- Verify Firebase app ID is correct | ||
- Ensure you have required permissions | ||
|
||
3. **Version generation fails** | ||
- For git-based: Ensure git history is available | ||
- For Firebase: Check Firebase credentials and permissions | ||
- For Play Store: Verify Play Console access and permissions |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
source "https://rubygems.org" | ||
|
||
ruby File.read(".ruby-version").strip | ||
ruby '3.3.5' | ||
|
||
gem "fastlane" | ||
|
||
|
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
Oops, something went wrong.