Start from scratch #283
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: Publishing | |
on: | |
push: | |
branches: | |
- develop | |
- hotfix/* | |
- release/* | |
tags: | |
- v*.*.* | |
jobs: | |
build: | |
name: Build | |
runs-on: macos-latest | |
environment: apple-app-store | |
strategy: | |
matrix: | |
platform: | |
- iOS | |
- macOS | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Cache packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-spm- | |
- name: Set up signing certificate | |
env: | |
CERTIFICATE_DEVELOPMENT_PRIVATE_KEY_B64: ${{ secrets.CERTIFICATE_DEVELOPMENT_PRIVATE_KEY_B64 }} | |
CERTIFICATE_DISTRIBUTION_PRIVATE_KEY_B64: ${{ secrets.CERTIFICATE_DISTRIBUTION_PRIVATE_KEY_B64 }} | |
CERTIFICATE_MAC_INSTALLER_PRIVATE_KEY_B64: ${{ secrets.CERTIFICATE_MAC_INSTALLER_PRIVATE_KEY_B64 }} | |
run: | | |
security create-keychain -p password build.keychain | |
security default-keychain -s build.keychain | |
security unlock-keychain -p password build.keychain | |
security set-keychain-settings build.keychain | |
for KEY in \ | |
$CERTIFICATE_DEVELOPMENT_PRIVATE_KEY_B64 \ | |
$CERTIFICATE_DISTRIBUTION_PRIVATE_KEY_B64 \ | |
$CERTIFICATE_MAC_INSTALLER_PRIVATE_KEY_B64; \ | |
do | |
echo $KEY | base64 --decode > /tmp/cert-fyreplace.p12 | |
security import /tmp/cert-fyreplace.p12 -k build.keychain -P '' -T /usr/bin/codesign | |
done | |
security set-key-partition-list -S apple-tool:,apple: -s -k password build.keychain | |
- name: Set up App Store Connect authentication | |
env: | |
APP_STORE_CONNECT_PRIVATE_KEY_B64: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY_B64 }} | |
run: echo $APP_STORE_CONNECT_PRIVATE_KEY_B64 | base64 --decode > /tmp/connect-key.p8 | |
- name: Prepare files | |
run: make | |
- name: Test app | |
if: ${{ matrix.platform == 'iOS' }} | |
run: | | |
xcodebuild test \ | |
-scheme Fyreplace \ | |
-destination 'platform=${{ matrix.platform }} Simulator,name=${{ vars.IOS_SIMULATOR }}' | |
xcrun simctl shutdown all | |
- name: Test app | |
if: ${{ matrix.platform == 'macOS' }} | |
run: | | |
xcodebuild test \ | |
DEVELOPMENT_TEAM=${{ vars.TEAM_ID }} \ | |
-allowProvisioningUpdates \ | |
-authenticationKeyPath /tmp/connect-key.p8 \ | |
-authenticationKeyID ${{ vars.APP_STORE_CONNECT_KEY_ID }} \ | |
-authenticationKeyIssuerID ${{ vars.APP_STORE_CONNECT_ISSUER_ID }} \ | |
-scheme Fyreplace \ | |
-destination platform=${{ matrix.platform }} | |
- name: Build app | |
run: | | |
xcodebuild archive \ | |
DEVELOPMENT_TEAM=${{ vars.TEAM_ID }} \ | |
-allowProvisioningUpdates \ | |
-authenticationKeyPath /tmp/connect-key.p8 \ | |
-authenticationKeyID ${{ vars.APP_STORE_CONNECT_KEY_ID }} \ | |
-authenticationKeyIssuerID ${{ vars.APP_STORE_CONNECT_ISSUER_ID }} \ | |
-scheme Fyreplace \ | |
-destination generic/platform=${{ matrix.platform }} \ | |
-archivePath archive.xcarchive | |
- name: Export to IPA | |
if: ${{ matrix.platform == 'iOS' }} | |
run: | | |
/usr/libexec/PlistBuddy -c "Add :method string" ExportOptions.plist | |
/usr/libexec/PlistBuddy -c "Set :method app-store-connect" ExportOptions.plist | |
/usr/libexec/PlistBuddy -c "Add :teamId string" ExportOptions.plist | |
/usr/libexec/PlistBuddy -c "Set :teamId ${{ vars.TEAM_ID }}" ExportOptions.plist | |
/usr/libexec/PlistBuddy -c "Add :provisioningProfiles dict" ExportOptions.plist | |
/usr/libexec/PlistBuddy -c "Add :provisioningProfiles:${{ vars.APP_ID }} string ${{ vars.PROVISIONING_PROFILE_NAME }}" ExportOptions.plist | |
xcodebuild export \ | |
-allowProvisioningUpdates \ | |
-authenticationKeyPath /tmp/connect-key.p8 \ | |
-authenticationKeyID ${{ vars.APP_STORE_CONNECT_KEY_ID }} \ | |
-authenticationKeyIssuerID ${{ vars.APP_STORE_CONNECT_ISSUER_ID }} \ | |
-archivePath archive.xcarchive \ | |
-exportArchive \ | |
-exportOptionsPlist ExportOptions.plist \ | |
-exportPath export | |
- name: Export to PKG | |
if: ${{ matrix.platform == 'macOS' }} | |
run: | | |
xcrun productbuild \ | |
--component archive.xcarchive/Products/Applications/Fyreplace.app \ | |
/Applications \ | |
export/Fyreplace.unsigned | |
xcrun productsign \ | |
--sign ${{ vars.TEAM_ID }} \ | |
export/Fyreplace.unsigned \ | |
export/Fyreplace.pkg | |
- uses: actions/upload-artifact@v4 | |
if: ${{ matrix.platform == 'iOS' }} | |
with: | |
name: Fyreplace.ipa | |
path: export/*.ipa | |
if-no-files-found: error | |
- uses: actions/upload-artifact@v4 | |
if: ${{ matrix.platform == 'macOS' }} | |
with: | |
name: Fyreplace.pkg | |
path: export/*.pkg | |
if-no-files-found: error | |
publish: | |
name: Publish | |
needs: build | |
runs-on: macos-latest | |
environment: apple-app-store | |
strategy: | |
matrix: | |
platform: | |
- ios | |
- osx | |
steps: | |
- uses: actions/download-artifact@v4 | |
if: ${{ matrix.platform == 'ios' }} | |
with: | |
name: Fyreplace.ipa | |
path: /tmp | |
- uses: actions/download-artifact@v4 | |
if: ${{ matrix.platform == 'osx' }} | |
with: | |
name: Fyreplace.pkg | |
path: /tmp | |
- name: Set up App Store Connect authentication | |
env: | |
APP_STORE_CONNECT_PRIVATE_KEY_B64: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY_B64 }} | |
run: | | |
mkdir ~/private_keys | |
echo $APP_STORE_CONNECT_PRIVATE_KEY_B64 | base64 --decode > ~/private_keys/AuthKey_${{ vars.APP_STORE_CONNECT_KEY_ID }}.p8 | |
- name: Upload to App Store Connect | |
run: | | |
xcrun altool \ | |
--upload-app \ | |
--type ${{ matrix.platform }} \ | |
--file /tmp/Fyreplace.* \ | |
--apiKey ${{ vars.APP_STORE_CONNECT_KEY_ID }} \ | |
--apiIssuer ${{ vars.APP_STORE_CONNECT_ISSUER_ID }} |