Skip to content

Xcode - Build and Upload #31

Xcode - Build and Upload

Xcode - Build and Upload #31

Workflow file for this run

name: Xcode - Build and Upload
on:
push:
branches: [ "master" ]
workflow_dispatch:
jobs:
build:
name: Build using xcodebuild
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install the Apple certificate
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_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
- name: Install App Store Connect private key
id: appstore-private-key
env:
API_KEY_ID: ${{ secrets.APPSTORE_API_KEY_ID }}
API_PRIVATE_KEY: ${{ secrets.APPSTORE_API_PRIVATE_KEY }}
run: |
PRIV_KEY_DIR="$HOME/private_keys"
AUTH_KEY_FILE="$PRIV_KEY_DIR/AuthKey_$API_KEY_ID.p8"
echo "::set-output name=AUTH_KEY_PATH::$AUTH_KEY_FILE"
mkdir -p "$PRIV_KEY_DIR"
echo "$API_PRIVATE_KEY" > "$AUTH_KEY_FILE"
- name: Cache dependencies (Carthage)
uses: actions/cache@v2
id: cache-dependecies-carthage
with:
path: ./Carthage
key: ${{ runner.OS }}-cache-carthage-${{ hashFiles('./Cartfile.resolved') }}
restore-keys: |
${{ runner.OS }}-cache-carthage-
- name: Bootstrap (Carthage)
if: steps.cache-dependecies-carthage.outputs.cache-hit != 'true'
run: ./carthage.sh bootstrap --platform ios,tvos --use-xcframeworks
shell: bash
- name: Cache dependencies
uses: actions/cache@v2
id: cache-dependecies
with:
path: ./Thirdparties
key: ${{ runner.OS }}-cache-${{ hashFiles('./bootstrap.sh') }}
restore-keys: |
${{ runner.OS }}-cache-
- name: Bootstrap
if: steps.cache-dependecies.outputs.cache-hit != 'true'
run: ./bootstrap.sh
shell: bash
- name: Bump version
env:
build_number: ${{ github.run_number }}
run: |
xcrun agvtool new-version -all $((14+$build_number)) # temp fix
- name: Build, acrhive and upload (SwiftyTorrent)
uses: ./.github/actions/build-archive-upload
with:
scheme: SwiftyTorrent
build_settings: 'ENABLE_BITCODE=NO'
platform: ios
auth_key_issuer_id: ${{ secrets.APPSTORE_ISSUER_ID }}
auth_key_id: ${{ secrets.APPSTORE_API_KEY_ID }}
auth_key_path: ${{ steps.appstore-private-key.outputs.AUTH_KEY_PATH }}
- name: Build, acrhive and upload (SwiftyTV)
uses: ./.github/actions/build-archive-upload
with:
scheme: SwiftyTV
build_settings: 'ENABLE_BITCODE=YES'
platform: tvos
auth_key_issuer_id: ${{ secrets.APPSTORE_ISSUER_ID }}
auth_key_id: ${{ secrets.APPSTORE_API_KEY_ID }}
auth_key_path: ${{ steps.appstore-private-key.outputs.AUTH_KEY_PATH }}