Merge pull request #519 from pennlabs/anli/03-23-tweak-dining-menu-he… #177
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: CI | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: macos-13 | |
steps: | |
- name: Select Xcode 15 | |
# https://stackoverflow.com/questions/65821440/how-to-select-xcode-version-in-fastlane-when-using-github-actions | |
run: sudo xcode-select -s '/Applications/Xcode_15.0.app/Contents/Developer' | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Create Config File | |
run: | | |
cat << EOF > Config/Release.xcconfig | |
#include "Pods/Target Support Files/Pods-PennMobile/Pods-PennMobile.release.xcconfig" | |
LABS_OAUTH_CLIENT_ID = ${{ secrets.LABS_OAUTH_CLIENT_ID }} | |
APP_NAME = Penn Mobile | |
APP_BUNDLE_ID = org.pennlabs.PennMobile | |
EOF | |
- name: CREATE GoogleService-Info.plist | |
run: | | |
cat << EOF > PennMobile/Supporting_Files/GoogleService-Info.plist | |
${{ secrets.GOOGLE_SERVICE_INFO_PLIST }} | |
EOF | |
- name: Create fastlane API key json | |
run: | | |
cat << EOF > api_key.json | |
${{ secrets.FASTLANE_JSON_KEY }} | |
EOF | |
- name: Cache CocoaPods | |
uses: actions/cache@v2 | |
with: | |
path: Pods | |
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} | |
restore-keys: | | |
${{ runner.os }}-pods- | |
- name: Cache SPM | |
uses: actions/cache@v2 | |
with: | |
path: .build | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-spm- | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.6.8' | |
bundler-cache: true | |
- name: Download pods | |
run: bundle exec pod install | |
- name: Fix pod script | |
# https://stackoverflow.com/questions/63533819/rsync-error-some-files-could-not-be-transferred-code-23-command-phasescriptex | |
run: find Pods/Target\ Support\ Files/Pods-PennMobile -name '*-frameworks.sh' -exec sed -i '' 's|source="\$(readlink "\${source}")"|source="\$(readlink -f "\${source}")"|g' {} + | |
- name: Linter | |
run: Pods/SwiftLint/swiftlint PennMobile/* | |
- name: Install the Apple certificate and provisioning profile | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }} | |
BUILD_PROVISION_PROFILE_WIDGET_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_WIDGET_BASE64 }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
# create variables | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision | |
PP_WIDGET_PATH=$RUNNER_TEMP/build_pp_widget.mobileprovision | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
# import certificate and provisioning profile from secrets | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode > "$CERTIFICATE_PATH" | |
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode > "$PP_PATH" | |
echo -n "$BUILD_PROVISION_PROFILE_WIDGET_BASE64" | base64 --decode > "$PP_WIDGET_PATH" | |
# create temporary keychain | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
# import certificate to keychain | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
# apply provisioning profile | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles | |
cp $PP_WIDGET_PATH ~/Library/MobileDevice/Provisioning\ Profiles | |
- name: Build app | |
run: bundle exec fastlane ci_beta |