Replaces Coroutine Dispatcher.IO with seperate BackgroundExecutor in … #15
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: Publishing app to PlayStore and AppStore | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
publish_app: | |
name: Publishing app | |
runs-on: macos-latest | |
permissions: | |
contents: write | |
env: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
API_KEY: ${{ secrets.API_KEY }} | |
REVENUECAT_API_KEY_ANDROID: ${{ secrets.REVENUECAT_API_KEY_ANDROID }} | |
REVENUECAT_API_KEY_IOS: ${{ secrets.REVENUECAT_API_KEY_IOS }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: zulu | |
cache: gradle | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Caching/Restoring Swift Package | |
uses: actions/cache@v3 | |
with: | |
path: /Users/runner/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-spm- | |
# Android building, signing | |
- name: Decode Android Keystore | |
env: | |
ENCODED_KEYSTORE_FILE_STRING: ${{ secrets.SIGNING_KEY_STORE_FILE_BASE64 }} | |
ENCODED_KEYSTORE_PROPERTIES_STRING: ${{ secrets.SIGNING_KEY_STORE_PROPERTIES_BASE64 }} | |
run: | | |
mkdir -p androidApp/keystore | |
echo $ENCODED_KEYSTORE_FILE_STRING > keystore-b64.txt | |
base64 -d -i keystore-b64.txt > androidApp/keystore/keystore.jks | |
echo $ENCODED_KEYSTORE_PROPERTIES_STRING > keystore-props-b64.txt | |
base64 -d -i keystore-props-b64.txt > androidApp/keystore/keystore.properties | |
- name: Build Release apk with Gradle | |
run: ./gradlew assembleRelease | |
- name: Get Android App Name With Version semantics | |
run: | | |
appName=$(./gradlew -q getAppName) | |
echo "APP_NAME=${appName}" >> $GITHUB_ENV | |
echo "APK_PATH=androidApp/build/outputs/apk/release/${appName}.apk" >> $GITHUB_ENV | |
- name: Rename APK | |
run: | | |
mv androidApp/build/outputs/apk/release/androidApp-release.apk ${{ env.APK_PATH }} | |
- name: Build Release Android app bundle with Gradle | |
run: ./gradlew bundleRelease | |
# iOS building, signing | |
- name: Create directory for App Store Connect private keys | |
run: mkdir -p ~/private_keys | |
- name: Install the Apple certificate and provisioning profile | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.IOS_APP_DISTRIBUTION_CERT_BASE64 }} | |
P12_PASSWORD: ${{ secrets.IOS_APP_CERT_PASS }} | |
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.IOS_APP_PROVISION_PROFILE_BASE64 }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
APPSTORE_CONNECT_API_KEY_BASE64: ${{ secrets.IOS_APPSTORE_CONNECT_API_KEY_BASE64 }} | |
APPSTORE_API_KEY_ID: ${{ secrets.IOS_APPSTORE_API_KEY_ID }} | |
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, provisioning profile and apikey from secrets | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH | |
echo -n "$APPSTORE_CONNECT_API_KEY_BASE64" | base64 --decode -o ~/private_keys/AuthKey_$APPSTORE_API_KEY_ID.p8 | |
# 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: Build iOSApp archive | |
run: | | |
xcodebuild -workspace iosApp/iosApp.xcworkspace \ | |
-scheme iosApp \ | |
-sdk iphoneos \ | |
-archivePath $RUNNER_TEMP/iosApp.xcarchive \ | |
-configuration Release \ | |
-destination generic/platform=iOS \ | |
clean archive | |
- name: Export iosApp ipa file | |
env: | |
EXPORT_OPTIONS_PLIST: ${{ secrets.IOS_EXPORT_OPTIONS_BASE64 }} | |
run: | | |
EXPORT_OPTS_PATH=$RUNNER_TEMP/ExportOptions.plist | |
echo -n "$EXPORT_OPTIONS_PLIST" | base64 --decode -o $EXPORT_OPTS_PATH | |
xcodebuild -exportArchive -archivePath $RUNNER_TEMP/iosApp.xcarchive -exportOptionsPlist $EXPORT_OPTS_PATH -exportPath $RUNNER_TEMP/build | |
- name: Upload app files to Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: appArtifacts | |
path: | | |
${{ env.APK_PATH }} | |
${{ runner.temp }}/build | |
retention-days: 7 | |
- name: Publish android app to Play Store (Alpha track) | |
id: deploy | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }} | |
packageName: com.travelapp.findtravelnow | |
releaseFiles: androidApp/build/outputs/bundle/release/androidApp-release.aab | |
track: alpha | |
whatsNewDirectory: distribution/whatsnew | |
- name: Install iTMSTransporter | |
run: | | |
wget https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/resources/download/public/Transporter__OSX/bin/ -O iTMSTransporter.pkg | |
sudo installer -pkg iTMSTransporter.pkg -target / | |
- name: Publish iOS app to AppStore | |
env: | |
APPSTORE_API_KEY_ID: ${{ secrets.IOS_APPSTORE_API_KEY_ID }} | |
APPSTORE_API_KEY_ISSUER_ID: ${{ secrets.IOS_APPSTORE_API_KEY_ISSUER_ID }} | |
run: | | |
bundleShortVersion=$(plutil -extract CFBundleShortVersionString raw -o - iosApp/iosApp/Info.plist) | |
bundleVersion=$(plutil -extract CFBundleVersion raw -o - iosApp/iosApp/Info.plist) | |
xcrun altool --upload-package $RUNNER_TEMP/build/FindTravelNow.ipa -t ios \ | |
--apple-id 6471192930 \ | |
--bundle-id com.measify.findtravelnow \ | |
--bundle-short-version-string ${bundleShortVersion} \ | |
--bundle-version ${bundleVersion} \ | |
--apiKey $APPSTORE_API_KEY_ID \ | |
--apiIssuer $APPSTORE_API_KEY_ISSUER_ID --verbose | |
- name: Create new release from tag | |
uses: softprops/action-gh-release@v1 | |
with: | |
generate_release_notes: true | |
files: | | |
androidApp/build/outputs/bundle/release/androidApp-release.aab | |
${{ env.APK_PATH }} | |
${{ runner.temp }}/build/FindTravelNow.ipa | |
body_path: distribution/whatsnew/whatsnew-en-US | |
token: ${{ env.github_token }} |