Upload to Testflight #44
Workflow file for this run
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: Upload to Testflight | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- closed | |
branches: | |
- 'release/*' | |
push: | |
branches: | |
- 'release/*' | |
jobs: | |
build: | |
runs-on: macos-14 | |
steps: | |
- uses: maxim-lobanov/[email protected] | |
with: | |
xcode-version: '16.1.0' | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Remove existing localisation directory | |
run: rm -rf ${{ github.workspace }}/station.localization | |
- name: Clone localisation submodule | |
run: git clone -b master https://github.com/ruuvi/station.localization.git ${{ github.workspace }}/station.localization | |
- name: Install the Apple certificate and provisioning profiles | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode > $CERTIFICATE_PATH | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles | |
echo -n "${{ secrets.MAIN_APP_ADHOC_PROVISION_PROFILE_BASE64 }}" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/match_AdHoc_com.ruuvi.station.mobileprovision | |
echo -n "${{ secrets.WIDGETS_APP_ADHOC_PROVISION_PROFILE_BASE64 }}" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/match_AdHoc_com.ruuvi.station.widgets.mobileprovision | |
echo -n "${{ secrets.INTENTS_APP_ADHOC_PROVISION_PROFILE_BASE64 }}" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/match_AdHoc_com.ruuvi.station.intents.mobileprovision | |
echo -n "${{ secrets.PNSERVICE_APP_ADHOC_PROVISION_PROFILE_BASE64 }}" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/match_AdHoc_com.ruuvi.station.pnservice.mobileprovision | |
echo -n "${{ secrets.MAIN_APP_APPSTORE_PROVISION_PROFILE_BASE64 }}" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/match_AppStore_com.ruuvi.station.mobileprovision | |
echo -n "${{ secrets.WIDGETS_APP_APPSTORE_PROVISION_PROFILE_BASE64 }}" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/match_AppStore_com.ruuvi.station.widgets.mobileprovision | |
echo -n "${{ secrets.INTENTS_APP_APPSTORE_PROVISION_PROFILE_BASE64 }}" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/match__AppStore_com.ruuvi.station.intents.mobileprovision | |
echo -n "${{ secrets.PNSERVICE_APP_APPSTORE_PROVISION_PROFILE_BASE64 }}" | base64 --decode > ~/Library/MobileDevice/Provisioning\ Profiles/match_AppStore_com.ruuvi.station.pnservice.mobileprovision | |
- name: Increment build number | |
run: | | |
make set_build_number | |
- name: Tools cache | |
uses: actions/cache@v4 | |
with: | |
path: .tools/ | |
key: ${{ runner.os }}-tools-${{ hashFiles('/.tools/') }} | |
restore-keys: | | |
${{ runner.os }}-tools- | |
- name: Make xcodeproj | |
run: | | |
make xcodeproj | |
- name: Resolve Swift Packages | |
run: | | |
xcodebuild -resolvePackageDependencies | |
- name: SPM Cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/Library/Developer/Xcode/DerivedData/Ruuvi*/SourcePackages/ | |
key: ${{ runner.os }}-Ruuvi-${{ hashFiles('Ruuvi.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-Ruuvi- | |
- name: Build app | |
run: | | |
xcodebuild -project Ruuvi.xcodeproj -scheme station -configuration Release -archivePath ./Build/Station.xcarchive archive -allowProvisioningUpdates -quiet -destination 'generic/platform=iOS' | |
- name: Export IPA | |
env: | |
EXPORT_PLIST: ${{ secrets.APPSTORE_EXPORT_OPTIONS }} | |
run: | | |
EXPORT_PLIST_PATH=${{ runner.temp }}/ExportOptions.plist | |
echo -n "$EXPORT_PLIST" | base64 --decode > $EXPORT_PLIST_PATH | |
xcodebuild -exportArchive -archivePath ./Build/Station.xcarchive -exportOptionsPlist $EXPORT_PLIST_PATH -exportPath ${{ runner.temp }}/export | |
- name: Upload to testflight | |
run: | | |
IPA_PATH=$RUNNER_TEMP/export/station.ipa | |
xcrun altool --validate-app -f $IPA_PATH -t ios --username ${{ secrets.APPLE_USER }} --password ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
xcrun altool --upload-app -f $IPA_PATH -t ios --username ${{ secrets.APPLE_USER }} --password ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
- name: Clean up keychain and provisioning profiles | |
if: ${{ always() }} | |
run: | | |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db | |
rm -rf ~/Library/MobileDevice/Provisioning\ Profiles/* |