Skip to content

Commit

Permalink
Adding iOS workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Burzo committed Mar 30, 2024
1 parent ecff7eb commit 5199212
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 121 deletions.
171 changes: 83 additions & 88 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,31 @@
name: Build and Deploy to App Distribution
name: Build and Deploy to App Distribution and Testflight

on:
workflow_dispatch:
push:
tags:
- "*"
branches:
- "add-ios-workflow"

jobs:
# ios-build:
# environment: development
# name: iOS development build
# runs-on: [self-hosted, 'macOS']
# steps:
# - name: Cancel previous runs
# uses: styfle/cancel-workflow-action@0.12.0
# - name: Checkout repo from dev branch
# uses: actions/checkout@v3
# - name: create-json
# id: add-firebase-credentials
# uses: jsdaniell/create-json@v1.2.2
# with:
# name: 'wildlife-watcher-service-account.json'
# json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
# dir: './fastlane'
# - name: Copy Provisioning certificate
# run: echo -n "${{ secrets.IOS_CERT_PROVISION }}" | base64 --decode > ./fastlane/profile.mobileprovision
# - name: Copy private key
# run: echo -n "${{ secrets.IOS_CERT_PRIVATE_KEY }}" | base64 --decode > ./fastlane/cert.p12
# - name: Copy Google Services plist file
# run: echo -n "${{ secrets.IOS_GOOGLE_SERVICES_PLIST }}" | base64 --decode > ./ios/GoogleService-Info.plist
# - name: Install npm dependency
# run: npm install
# - name: Install bundler
# run: gem install bundler -v 2.4.10
# - name: Install gem plugins
# run: bundle install
# - name: Cache cocoapods
# uses: actions/cache@v3
# with:
# path: ./ios/Pods
# key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
# restore-keys: |
# ${{ runner.os }}-pods-
# - name: Install dependencies with CocoaPods
# run: cd ios && bundle exec pod install && cd ..
# - name: Run fastlane
# run: bundle exec fastlane ios build_debug
# env:
# IOS_CERT_PASSWORD: ${{ secrets.IOS_CERT_PASSWORD }}
android-build:
environment: development
name: Android development build
extract-version:
name: Extract Version
runs-on: ubuntu-latest
container:
image: reactnativecommunity/react-native-android
outputs:
version: 0.0.4
steps:
- name: Extract version
id: extract-version
run: |
VERSION="${{ github.ref_name }}"
echo "Original version: $VERSION"
VERSION="${VERSION#"v"}"
echo "Processed version: $VERSION"
echo "::set-output name=version::$VERSION"
ios-build:
needs: extract-version
environment: development
name: iOS development build
runs-on: macos-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.12.0
Expand All @@ -66,48 +38,71 @@ jobs:
name: "wildlife-watcher-service-account.json"
json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
dir: "./fastlane"
- name: create-json
id: add-android-credentials
uses: jsdaniell/create-json@v1.2.2
with:
name: "google-services.json"
json: ${{ secrets.ANDROID_GOOGLE_SERVICES_JSON }}
dir: "./android/app"
- name: Copy keystore file
run: echo -n "${{ secrets.ANDROID_RELEASE_KEYSTORE }}" | base64 --decode > ./android/keystores/release.keystore
- name: Copy keystore properties file
run: echo -n "${{ secrets.ANDROID_RELEASE_KEYSTORE_PROPS }}" | base64 --decode > ./android/keystores/release.keystore.properties
- name: Copy Provisioning certificate
run: echo -n "${{ secrets.IOS_CERT_PROVISION }}" | base64 --decode > ./fastlane/profile.mobileprovision
- name: Copy private key
run: echo -n "${{ secrets.IOS_CERT_PRIVATE_KEY }}" | base64 --decode > ./fastlane/cert.p12
- name: Copy Google Services plist file
run: echo -n "${{ secrets.IOS_GOOGLE_SERVICES_PLIST }}" | base64 --decode > ./ios/GoogleService-Info.plist
- name: Install npm dependency
run: npm install
- name: Install bundler
run: |
gem install bundler -v 2.4.10
run: gem install bundler -v 2.4.10
- name: Install gem plugins
run: |
bundle install
# - uses: actions/cache@v3
# with:
# path: |
# ./android/.gradle/caches
# ./android/.gradle/wrapper
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
# restore-keys: |
# ${{ runner.os }}-gradle-
- name: Extract version
id: extract-version
run: |
VERSION="${{ github.ref_name }}"
echo "Original version: $VERSION"
VERSION="${VERSION#"v"}"
echo "Processed version: $VERSION"
echo "::set-output name=version::$VERSION"
run: bundle install
- name: Install dependencies with CocoaPods
run: cd ios && bundle exec pod install && cd ..
- name: Run fastlane
run: |
echo ${{ github.run_number }}
bundle exec fastlane android build_release
run: bundle exec fastlane ios build_release
env:
APP_VERSION: ${{ steps.extract-version.outputs.version }}
APP_CODE_VERSION: ${{ github.run_number }}
APP_ID: ${{ secrets.APP_ID }}
ANDROID_ARTEFACT_PATH: ${{ secrets.ANDROID_ARTEFACT_PATH }}
TESTERS: ${{ vars.TESTERS }}
IOS_CERT_PASSWORD: ${{ secrets.IOS_CERT_PASSWORD }}
IOS_KEYCHAIN_PASSWORD: ${{ secrets.IOS_KEYCHAIN_PASSWORD }}
APP_VERSION: ${{ needs.extract-version.outputs.version }}
# android-build:
# needs: extract-version
# environment: development
# name: Android development build
# runs-on: ubuntu-latest
# container:
# image: reactnativecommunity/react-native-android
# steps:
# - name: Cancel previous runs
# uses: styfle/cancel-workflow-action@0.12.0
# - name: Checkout repo from dev branch
# uses: actions/checkout@v3
# - name: create-json
# id: add-firebase-credentials
# uses: jsdaniell/create-json@v1.2.2
# with:
# name: "wildlife-watcher-service-account.json"
# json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON }}
# dir: "./fastlane"
# - name: create-json
# id: add-android-credentials
# uses: jsdaniell/create-json@v1.2.2
# with:
# name: "google-services.json"
# json: ${{ secrets.ANDROID_GOOGLE_SERVICES_JSON }}
# dir: "./android/app"
# - name: Copy keystore file
# run: echo -n "${{ secrets.ANDROID_RELEASE_KEYSTORE }}" | base64 --decode > ./android/keystores/release.keystore
# - name: Copy keystore properties file
# run: echo -n "${{ secrets.ANDROID_RELEASE_KEYSTORE_PROPS }}" | base64 --decode > ./android/keystores/release.keystore.properties
# - name: Install npm dependency
# run: npm install
# - name: Install bundler
# run: |
# gem install bundler -v 2.4.10
# - name: Install gem plugins
# run: |
# bundle install
# - name: Run fastlane
# run: |
# echo ${{ github.run_number }}
# bundle exec fastlane android build_release
# env:
# APP_VERSION: ${{ needs.extract-version.outputs.version }}
# APP_CODE_VERSION: ${{ github.run_number }}
# APP_ID: ${{ secrets.APP_ID }}
# ANDROID_ARTEFACT_PATH: ${{ secrets.ANDROID_ARTEFACT_PATH }}
# TESTERS: ${{ vars.TESTERS }}
25 changes: 15 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ GEM
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
claide (1.1.0)
cocoapods (1.14.3)
addressable (~> 2.8)
Expand Down Expand Up @@ -154,26 +155,29 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-firebase_app_distribution (0.7.4)
fastlane-plugin-firebase_app_distribution (0.9.0)
google-apis-firebaseappdistribution_v1 (~> 0.3.0)
google-apis-firebaseappdistribution_v1alpha (~> 0.2.0)
fastlane-plugin-versioning_android (0.1.1)
fastlane-plugin-versioning_ios (0.1.0)
ffi (1.16.3)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.54.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.2)
google-apis-core (0.14.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
googleauth (~> 1.9)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.a)
rexml
webrick
google-apis-firebaseappdistribution_v1 (0.3.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-firebaseappdistribution_v1alpha (0.2.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
Expand All @@ -183,7 +187,7 @@ GEM
google-cloud-core (1.6.1)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (2.1.0)
google-cloud-env (2.1.1)
faraday (>= 1.0, < 3.a)
google-cloud-errors (1.3.1)
google-cloud-storage (1.45.0)
Expand All @@ -194,7 +198,7 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.9.1)
googleauth (1.11.0)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.1)
jwt (>= 1.4, < 3.0)
Expand All @@ -209,13 +213,14 @@ GEM
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.7.1)
jwt (2.7.1)
jwt (2.8.1)
base64
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.20.0)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.3.0)
multipart-post (2.4.0)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.1)
Expand All @@ -236,7 +241,7 @@ GEM
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.18.0)
signet (0.19.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
Expand All @@ -258,7 +263,6 @@ GEM
concurrent-ruby (~> 1.0)
uber (0.1.0)
unicode-display_width (2.5.0)
webrick (1.8.1)
word_wrap (1.0.0)
xcodeproj (1.23.0)
CFPropertyList (>= 2.3.3, < 4.0)
Expand All @@ -281,6 +285,7 @@ DEPENDENCIES
fastlane
fastlane-plugin-firebase_app_distribution
fastlane-plugin-versioning_android
fastlane-plugin-versioning_ios

RUBY VERSION
ruby 2.7.8p225
Expand Down
40 changes: 17 additions & 23 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,32 @@
# update_fastlane

platform :ios do
desc "Build a debug version of the app"
lane :build_debug do
install_provisioning_profile(path: "./fastlane/profile.mobileprovision")
import_certificate(
keychain_name: "login.keychain",
certificate_path: "./fastlane/cert.p12",
certificate_password: ENV["IOS_CERT_PASSWORD"]
)
desc "Build a release version of the app"

build_ios_app(
silent: true,
scheme: 'WildlifeWatcher',
configuration: "Debug",
workspace: './ios/WildlifeWatcher.xcworkspace',
output_directory: './ios/ipa',
output_name: 'WildlifeWatcher.ipa',
buildlog_path: './ios/logs',
xcargs: "-allowProvisioningUpdates",
suppress_xcode_output: true

)
end
create_keychain(
name: "com.wildlife.wildlifewatcher",
password: ENV["IOS_KEYCHAIN_PASSWORD"],
default_keychain: true,
unlock: true,
timeout: 3600,
lock_when_sleeps: true
)

desc "Build a release version of the app"
lane :build_release do
install_provisioning_profile(path: "./fastlane/profile.mobileprovision")

import_certificate(
keychain_name: "login.keychain",
keychain_name: "com.wildlife.wildlifewatcher",
keychain_password: ENV["IOS_KEYCHAIN_PASSWORD"],
certificate_path: "./fastlane/cert.p12",
certificate_password: ENV["IOS_CERT_PASSWORD"]
)

ios_set_version(
version: ENV["APP_VERSION"],
xcodeproj: "./ios/WildlifeWatcher.xcodeproj"
)

build_ios_app(
silent: true,
scheme: 'WildlifeWatcher',
Expand Down
1 change: 1 addition & 0 deletions fastlane/Pluginfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

gem 'fastlane-plugin-firebase_app_distribution'
gem 'fastlane-plugin-versioning_android'
gem 'fastlane-plugin-versioning_ios'
14 changes: 14 additions & 0 deletions ios/WildlifeWatcher/ExportOptions.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key><string>app-store</string>
<key>teamID</key><string>D6C4Y4J2BS</string>
<key>provisioningProfiles</key>
<dict>
<key>com.wildlife.wildlifewatcher</key>
<string>Wildlife Watcher App Store</string>
</dict>
<key>signingStyle</key>
<string>manual</string>
</dict>
</plist>

0 comments on commit 5199212

Please sign in to comment.