Skip to content

Archive and export

Archive and export #91

Workflow file for this run

name: Archive and export
on:
release:
types: [published]
jobs:
build:
runs-on: macos-13
env:
XC_PROJECT: ${{ 'YDS.xcodeproj' }}
XC_SCHEME: ${{ 'YDS-Storybook' }}
XC_CONFIGURATION: ${{ 'Automation' }}
XC_ARCHIVE_PATH: ${{ './YDS.xcarichive' }}
XC_EXPORT_PATH: ${{ './artifacts' }}
KEYCHAIN: ${{ 'temporary.keychain' }}
DECRYPTED_CERTS_FILE_PATH: ${{ '.github/secrets/yourssuCertification.p12' }}
ENCRYPTED_CERTS_FILE_PATH: ${{ '.github/secrets/yourssuCertification.p12.gpg' }}
DECRYPTED_PROVISION_FILE_PATH: ${{ '.github/secrets/YDS_GithubActions_Dist.mobileprovision' }}
ENCRYPTED_PROVISION_FILE_PATH: ${{ '.github/secrets/YDS_GithubActions_Dist.mobileprovision.gpg' }}
CERTS_ENCRYPTION_PWD: ${{ secrets.CERTS_ENCRYPTION_PWD }}
PROVISION_ENCRYPTION_PWD: ${{ secrets.PROVISION_ENCRYPTION_PWD }}
CERTS_EXPORT_PWD: ${{ secrets.CERTS_EXPORT_PWD }}
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0.1'
- name: Select latest Xcode
run: "sudo xcode-select -s /Applications/Xcode.app"
- uses: actions/checkout@v4
- name: Get tag version
id: get_version
run: echo ::set-output name=RELEASE_VERSION::$(echo ${GITHUB_REF:11})
- name: Configure Keychain
run: |
security create-keychain -p "" "$KEYCHAIN"
security list-keychains -s "$KEYCHAIN"
security default-keychain -s "$KEYCHAIN"
security unlock-keychain -p "" "$KEYCHAIN"
security set-keychain-settings
- name : Configure Code Signing
run: |
gpg -d -o "$DECRYPTED_CERTS_FILE_PATH" --pinentry-mode=loopback --passphrase "$CERTS_ENCRYPTION_PWD" "$ENCRYPTED_CERTS_FILE_PATH"
gpg -d -o "$DECRYPTED_PROVISION_FILE_PATH" --pinentry-mode=loopback --passphrase "$PROVISION_ENCRYPTION_PWD" "$ENCRYPTED_PROVISION_FILE_PATH"
security import "$DECRYPTED_CERTS_FILE_PATH" -k "$KEYCHAIN" -P "$CERTS_EXPORT_PWD" -A
security set-key-partition-list -S apple-tool:,apple: -s -k "" "$KEYCHAIN"
mkdir -p "$HOME/Library/MobileDevice/Provisioning Profiles"
cd ".github/secrets"
echo `ls *.mobileprovision`
for PROVISION in `ls *.mobileprovision`
do
echo Hello, world!
UUID=`/usr/libexec/PlistBuddy -c 'Print :UUID' /dev/stdin <<< $(security cms -D -i ./$PROVISION)`
cp "./$PROVISION" "$HOME/Library/MobileDevice/Provisioning Profiles/$UUID.mobileprovision"
done
- name: Archive app
run: |
mkdir artifacts
xcodebuild archive -project YDS.xcodeproj -scheme YDS-Storybook -configuration $XC_CONFIGURATION -archivePath YDS.xcarchive "OTHER_CODE_SIGN_FLAGS=--keychain '$KEYCHAIN'"
- name: Export app
run: |
xcodebuild -exportArchive -archivePath YDS.xcarchive -exportOptionsPlist .github/ExportOptions.Plist -exportPath "$XC_EXPORT_PATH"
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: Artifacts
path: ./artifacts
- name: Upload app to TestFlight
uses: apple-actions/upload-testflight-build@v1
with:
app-path: './artifacts/YDS-Storybook.ipa'
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_API_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_API_PRIVATE_KEY }}