Skip to content

Commit

Permalink
add ios and android build files
Browse files Browse the repository at this point in the history
  • Loading branch information
yawenli2023 committed Jul 25, 2024
1 parent a88f5bc commit 7588a1e
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build-android-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Build Android app"

on:
push:
branches:
- main

jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install Java
uses: actions/setup-java@v3
with:
java-version: 17
distribution: adopt
cache: gradle

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"

- name: Run Yarn Install
run: |
npm i -g corepack
yarn install
- name: Build application
run: |
cd android
./gradlew assembleRelease
- name: Upload application
uses: actions/upload-artifact@v2
with:
name: app
path: android/app/build/outputs/apk/release/app-release.apk
retention-days: 3
105 changes: 105 additions & 0 deletions .github/workflows/build-ios-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: "Build iOS app"

on:
push:
branches:
- main

jobs:
build_with_signing:
runs-on: macos-latest
steps:
- name: check Xcode version
run: /usr/bin/xcodebuild -version
- name: checkout repository
uses: actions/checkout@v3
- name: Debug Workflow Variables
run: |
echo "CERTIFICATE_PATH: $CERTIFICATE_PATH"
echo "PP_PATH: $PP_PATH"
echo "KEYCHAIN_PATH: $KEYCHAIN_PATH"
echo "P12_PASSWORD: $P12_PASSWORD"
- name: Install the Apple certificate and provisioning profile
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
PROVISION_PROFILES_BASE64: ${{ secrets.PROVISION_PROFILES_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_ARCHIVE=$RUNNER_TEMP/mobile_pp.tgz
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$PROVISION_PROFILES_BASE64" | base64 --decode -o $PP_ARCHIVE
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
echo "P12_PASSWORD: $P12_PASSWORD"
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
tar xzvf $PP_ARCHIVE -C $RUNNER_TEMP
for PROVISION in `ls $RUNNER_TEMP/*.mobileprovision`
do
UUID=`/usr/libexec/PlistBuddy -c 'Print :UUID' /dev/stdin <<< $(security cms -D -i $PROVISION)`
cp $PROVISION ~/Library/MobileDevice/Provisioning\ Profiles/$UUID.mobileprovision
done
security find-identity -v -p codesigning
ls -l ~/Library/MobileDevice/Provisioning\ Profiles
- uses: actions/setup-node@v3
with:
node-version: "18"
cache: "yarn"

- name: Clean workspace
run: |
git clean -ffdx
npm cache clean --force
- name: Clean Xcode Build
run: |
cd ios
xcodebuild clean -workspace your_app.xcworkspace -scheme your_app
- name: install yarn dependencies
run: |
cd ios
yarn install
- name: install Cocoapod dependencies
run: |
cd ios
pod repo update
pod install
- name: build archive
run: |
cd ios
xcodebuild -workspace your_app.xcworkspace \
-scheme "your_app" \
-sdk iphoneos \
-configuration Release \
-destination generic/platform=iOS \
-archivePath $RUNNER_TEMP/your_app.xcarchive \
archive
- name: export ipa
env:
EXPORT_OPTIONS_PLIST: ${{ secrets.EXPORT_OPTIONS_PLIST }}
run: |
EXPORT_OPTS_PATH=$RUNNER_TEMP/ExportOptions.plist
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH
xcodebuild -exportArchive -archivePath $RUNNER_TEMP/your_app.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath $RUNNER_TEMP/build
- name: Upload application
uses: actions/upload-artifact@v3
with:
name: app
path: ${{ runner.temp }}/build
retention-days: 3

0 comments on commit 7588a1e

Please sign in to comment.