Skip to content

Merge branch 'main' of https://github.com/polymonster/dig #48

Merge branch 'main' of https://github.com/polymonster/dig

Merge branch 'main' of https://github.com/polymonster/dig #48

name: release
on:
push:
tags:
- '*'
jobs:
setup:
name: create release
runs-on: ubuntu-latest
steps:
- name: create_release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
release_tesflight:
needs: setup
runs-on: macos-13
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: release_tesflight
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DIG_IOS_DEV_64: ${{ secrets.DIG_IOS_DEV_64 }}
DIG_IOS_DIST_64: ${{ secrets.DIG_IOS_DIST_64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
API_KEY_H: ${{ secrets.API_KEY_H }}
REFS_VERSION: ${{ github.ref }}
run: |
# select xcode 15
sudo xcode-select -s /Applications/Xcode_15.0.1.app/Contents/Developer
# create variables
DIG_IOS_DEV_PATH=$RUNNER_TEMP/dig_ios_dev_certificate.p12
DIG_IOS_DIST_PATH=$RUNNER_TEMP/dig_ios_dist_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificates, one for dev, one for distribution
echo -n "$DIG_IOS_DEV_64" | base64 --decode -o $DIG_IOS_DEV_PATH
echo -n "$DIG_IOS_DIST_64" | base64 --decode -o $DIG_IOS_DIST_PATH
ls $RUNNER_TEMP
# 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 certificates to keychain
security import $DIG_IOS_DEV_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import $DIG_IOS_DIST_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 app/dist/ios/c201552e-2c71-4513-af2f-6fbfc39a4988.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles
cp app/dist/ios/67f31053-7cc4-4b1b-bdf3-030ef5ecff39.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles
ls ~/Library/MobileDevice/Provisioning\ Profiles
# bump version in plist
export VERSION=$(echo $REFS_VERSION| cut -d'/' -f 3)
export VERSION=$(echo $VERSION| cut -d'.' -f 3)
echo $VERSION
sed -i.bak "s/<key>CFBundleVersion<\/key><string>[0-9]*<\/string>/<key>CFBundleVersion<\/key><string>$VERSION<\/string>/g" app/dist/ios/Info.plist
# build and upload
cd app
pmtech/pmbuild ios
pmtech/pmbuild ios -libs
echo "$API_KEY_H" >> code/api_key.h
xcodebuild archive -workspace build/ios/diig_ios.xcworkspace -configuration Release -scheme diig -archivePath build/ios/diig_ios OTHER_CODE_SIGN_FLAGS="--keychain $KEYCHAIN_PATH" PROVISIONING_PROFILE="c201552e-2c71-4513-af2f-6fbfc39a4988" CODE_SIGN_STYLE="Manual"
xcodebuild -exportArchive -archivePath build/ios/diig_ios.xcarchive -exportPath build/ios/export -exportOptionsPlist dist/ios/ExportOptionsAgent.plist OTHER_CODE_SIGN_FLAGS="--keychain $KEYCHAIN_PATH" PROVISIONING_PROFILE="67f31053-7cc4-4b1b-bdf3-030ef5ecff39" CODE_SIGN_STYLE="Manual"
xcrun altool --upload-app -f build/ios/export/diig.ipa -t ios -u ${{secrets.APP_EMAIL}} -p ${{secrets.APP_PASSWORD}}