Skip to content

Commit

Permalink
Update ios.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
WindowsMEMZ authored Dec 15, 2023
1 parent 7c0c26a commit 2e81666
Showing 1 changed file with 38 additions and 31 deletions.
69 changes: 38 additions & 31 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,49 +41,56 @@ jobs:
rm vers/ver.txt
echo $MVER >> vers/ver.txt
agvtool new-version -all $MVER
- name: Commit Files
working-directory: vers
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -a -m "Updated versions"
- name: Push Changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: release-vers
directory: vers

- name: Prepare Environment
run: gem install fastlane

- name: Build and Archive
uses: sparkfabrik/[email protected]
with:
upload-to-testflight: false
configuration: Release
export-method: app-store
project-path: ./DarockBili.xcodeproj
scheme: DarockBili Watch App
output-path: MeowBili-Release.ipa
apple-key-id: ${{ secrets.ASCAPI_KEY_ID }}
apple-key-issuer-id: ${{ secrets.ASCAPI_ISSUER_ID }}
apple-key-content: ${{ secrets.ASCAPI_KEY }}
team-id: B57D8PP775
team-name: Yuxuan Chen
fastlane-env: stage
ios-app-id: com.darock.DarockBili

#- name: Archive DarockBili App
# env:
# ASCAPI_KEY_ID: ${{ secrets.ASCAPI_KEY_ID }}
# ASCAPI_ISSUER_ID: ${{ secrets.ASCAPI_ISSUER_ID }}
# run: |
# KEY_PATH=$RUNNER_TEMP/ascapi-key.p8
# xcodebuild -scheme 'DarockBili Watch App' -configuration Release DEVELOPMENT_TEAM=B57D8PP775 -archivePath DarockBili_Release.xcarchive clean archive CODE_SIGN_IDENTITY="Apple Development" -allowProvisioningUpdates -authenticationKeyPath $KEY_PATH -authenticationKeyID $ASCAPI_KEY_ID -authenticationKeyIssuerID $ASCAPI_ISSUER_ID

- name: Get App Store Connect API Key File
env:
ASCAPI_KEY: ${{ secrets.ASCAPI_KEY }}
run: |
KEY_PATH=$RUNNER_TEMP/ascapi-key.p8
echo -n "$ASCAPI_KEY" > $KEY_PATH
- name: Install the Apple certificate and provisioning profile for Xcode
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_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
- name: Archive DarockBili App
env:
ASCAPI_KEY_ID: ${{ secrets.ASCAPI_KEY_ID }}
ASCAPI_ISSUER_ID: ${{ secrets.ASCAPI_ISSUER_ID }}
run: |
KEY_PATH=$RUNNER_TEMP/ascapi-key.p8
xcodebuild -scheme 'DarockBili Watch App' -configuration Release DEVELOPMENT_TEAM=B57D8PP775 -archivePath DarockBili_Release.xcarchive clean archive CODE_SIGN_IDENTITY="Apple Development" -allowProvisioningUpdates -authenticationKeyPath $KEY_PATH -authenticationKeyID $ASCAPI_KEY_ID -authenticationKeyIssuerID $ASCAPI_ISSUER_ID
- name: Upload Debug Archive
uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -179,6 +186,6 @@ jobs:
run: |
mkdir ~/.private_keys
echo "$ASCAPI_KEY" >> ~/.private_keys/AuthKey_${ASCAPI_KEY_ID}.p8
- name: Upload to App Store Connect
run: xcrun altool --upload-app -f ./DarockBili_Release.ipa -t ios --apiKey $ASCAPI_KEY_ID --apiIssuer $ASCAPI_ISSUER_ID

0 comments on commit 2e81666

Please sign in to comment.