Merge pull request #565 from pennlabs/jhawk0224/fix-polls #226
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-14 | |
steps: | |
- name: Select Xcode 16 | |
# https://stackoverflow.com/questions/65821440/how-to-select-xcode-version-in-fastlane-when-using-github-actions | |
run: sudo xcode-select -s '/Applications/Xcode_16.0.app/Contents/Developer' | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Create Config File | |
run: | | |
cat << EOF > Config/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 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: '3.3.0' | |
bundler-cache: true | |
- 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 |