-
-
Save catalinmiron/c81fc4cea54aa0622dc24d345853bcf3 to your computer and use it in GitHub Desktop.
My CircleCI setup for React Native apps
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
version: 2 | |
defaults: &defaults | |
working_directory: ~/project | |
jobs: | |
ios: | |
<<: *defaults | |
macos: | |
xcode: '10.1.0' | |
steps: | |
- checkout | |
- run: | |
name: Install dependencies | |
command: npm install --ignore-engines | |
- run: | |
name: Install bundle | |
command: bundle install | |
- run: | |
name: Build app | |
command: bundle exec fastlane ios ci | |
android: | |
<<: *defaults | |
docker: | |
- image: sarathc/circle-android-fastlane:api-25-0.0.1 | |
steps: | |
- checkout | |
- run: | |
name: Install node | |
command: sudo curl https://nodejs.org/dist/v10.0.0/node-v10.0.0-linux-x64.tar.gz | sudo tar xzvf - --exclude CHANGELOG.md --exclude LICENSE --exclude README.md --strip-components 1 -C /usr/local/ | |
- run: | |
name: Upgrade NPM | |
command: sudo npm install -g npm | |
- run: | |
name: Install dependencies | |
command: npm ci --ignore-engines | |
- run: | |
name: Set gradle.properties | |
command: | | |
mkdir -p ~/.gradle | |
echo "MYAPP_RELEASE_STORE_FILE=$MYAPP_RELEASE_STORE_FILE" >> ~/.gradle/gradle.properties | |
echo "MYAPP_RELEASE_KEY_ALIAS=$MYAPP_RELEASE_KEY_ALIAS" >> ~/.gradle/gradle.properties | |
echo "MYAPP_RELEASE_STORE_PASSWORD=$MYAPP_RELEASE_STORE_PASSWORD" >> ~/.gradle/gradle.properties | |
echo "MYAPP_RELEASE_KEY_PASSWORD=$MYAPP_RELEASE_KEY_PASSWORD" >> ~/.gradle/gradle.properties | |
- run: | |
name: Put keystore | |
command: echo "$KEYSTORE" | base64 -d > android/app/anysticker.keystore | |
- run: | |
name: Set supplyfile | |
command: echo "$SUPPLYFILE" | base64 -d > android/supplyfile.json | |
- run: yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses || echo "okay okay" | |
- run: | |
name: Bundle android | |
command: npm run bundle-android | |
- run: | |
name: Install bundle | |
command: bundle install | |
- run: | |
name: Build app | |
command: bundle exec fastlane android ci | |
- store_artifacts: | |
path: android/app/build/outputs/apk/release/app-release.apk | |
workflows: | |
version: 2 | |
build: | |
jobs: | |
- hold-ios: | |
type: approval | |
- hold-android: | |
type: approval | |
- ios: | |
requires: | |
- hold-ios | |
- android: | |
requires: | |
- hold-android |
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
fastlane_version '2.105.2' | |
before_all do | |
ensure_git_branch | |
git_pull | |
end | |
platform :ios do | |
desc 'Fetch certificates and provisioning profiles' | |
lane :certificates do | |
match( | |
app_identifier: 'jonnyburger.anysticker', | |
type: 'appstore', | |
username: "[email protected]", | |
git_url: "https://github.com/JonnyBurger/fake-repository-with-ios-certificates", | |
team_id: "ABCDEFFHIJK", | |
skip_docs: true | |
) | |
end | |
desc 'Build the iOS application.' | |
private_lane :build do | |
certificates | |
increment_build_number( | |
xcodeproj: './ios/anysticker.xcodeproj', | |
build_number: latest_testflight_build_number( | |
username: '[email protected]', | |
team_name: "Jonathan Burger", | |
app_identifier: 'jonnyburger.anysticker' | |
).to_i + 1 | |
) | |
gym( | |
scheme: 'anysticker', | |
project: './ios/anysticker.xcodeproj', | |
configuration: "Release", | |
export_method: "app-store" | |
) | |
end | |
desc 'Ship to Testflight.' | |
lane :beta do | |
build | |
pilot(username: '[email protected]', team_name: "Jonathan Burger", skip_waiting_for_build_processing: true) | |
end | |
desc 'Build on CircleCI' | |
lane :ci do | |
setup_circle_ci | |
beta | |
end | |
end | |
platform :android do | |
desc 'Ship to Playstore Beta.' | |
lane :ci do | |
gradle(task: 'clean', project_dir: 'android/') | |
gradle(task: 'assemble', build_type: 'Release', project_dir: 'android/', properties: { | |
versionCode: [google_play_track_version_codes( | |
track: 'release', | |
json_key: 'android/supplyfile.json', | |
package_name: 'jonnyburger.anysticker', | |
).max || 0, google_play_track_version_codes( | |
track: 'beta', | |
json_key: 'android/supplyfile.json', | |
package_name: 'jonnyburger.anysticker', | |
).max || 0].max + 1 | |
}) | |
supply(track: 'beta', track_promote_to: 'beta', json_key: 'android/supplyfile.json', package_name: 'jonnyburger.anysticker') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment