publish signed mobile artifacts #155
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: publish signed mobile artifacts | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
workflow_dispatch: | |
inputs: | |
versionNumber: | |
description: 'version number' | |
required: true | |
default: '0.1.1' | |
env: | |
DOTNET_NOLOGO: true # Disable the .NET logo | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience | |
DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry | |
jobs: | |
publish-android: | |
runs-on: windows-2022 | |
name: Android Build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Pull Version from Tag | |
uses: nowsprinting/check-version-format-action@v3 | |
id: version | |
with: | |
prefix: 'v' | |
- name: Use Version From Tag | |
shell: bash | |
if: steps.version.outputs.is_valid == 'true' | |
run: | | |
echo "VERSION=${{steps.version.outputs.full_without_prefix}}" >> $GITHUB_ENV | |
echo "${VERSION} is our version number" | |
- name: Use Version from User Input | |
shell: bash | |
if: steps.version.outputs.is_valid == 'false' | |
run: | | |
echo "VERSION=${{github.event.inputs.versionNumber}}" >> $GITHUB_ENV | |
echo "${VERSION} is our version number" | |
- name: create a custom version using run number offset by 1000 (run_number + 1000) | |
shell: bash | |
run: | | |
echo "VERSION_NUMBER_WITH_OFFSET=$((1000+GITHUB_RUN_NUMBER))" >> $GITHUB_ENV | |
- name: App Settings Variable Substitution | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: 'appsettings.json' | |
env: | |
AppSettings.SyncFusionLicenseKey: ${{ secrets.SYNCFUSION_LICENSE_KEY }} | |
AppSettings.IfpaApiKey: ${{ secrets.IFPA_API_KEY }} | |
- name: Add Google Maps API Key to Android Manifest | |
run: | | |
$pathToXml = "Platforms/Android/AndroidManifest.xml" | |
$xml=[xml](Get-Content $pathToXml) | |
$xml.manifest.application."meta-data".value = "${{ secrets.GOOGLE_MAPS_API_KEY }}" | |
$xml.Save($pathToXml) | |
# # Store Android Signing Keystore and password in Secrets using base64 encoding | |
# # https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/certutil | |
# # commandline util to encode to base64 on windows | |
- name: Setup Keystore File | |
run: | | |
echo "${{ secrets.IFPA_ANDROID_KEYSTORE }}" > ifpamaui.keystore.asc | |
certutil -decode ifpamaui.keystore.asc ifpa-keystore.jks | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@4d4a70f4a5b2a5a5329f13be4ac933f2c9206ac0 | |
with: | |
dotnet-version: 8.0.x | |
- name: Install MAUI Workload | |
run: dotnet workload install maui android | |
- name: Restore Dependencies | |
run: dotnet restore IfpaMaui.csproj | |
- name: Build MAUI Android | |
run: dotnet publish IfpaMaui.csproj -c Release -f net8.0-android34.0 -p:Version=$Env:VERSION -p:ApplicationDisplayVersion=$Env:VERSION -p:ApplicationVersion=${{ env.VERSION_NUMBER_WITH_OFFSET }} --no-restore -p:AndroidKeyStore=True /p:AndroidSigningKeyStore=ifpa-keystore.jks /p:AndroidSigningKeyAlias=upload /p:AndroidSigningKeyPass="${{ secrets.IFPA_ANDROID_KEYSTORE_PASSWORD }}" /p:AndroidSigningStorePass="${{ secrets.IFPA_ANDROID_KEYSTORE_PASSWORD }}" --no-restore | |
- name: Upload Android Artifact | |
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 | |
with: | |
if-no-files-found: error | |
name: ifpamaui-android-signed-build | |
path: bin/Release/net8.0-android34.0/publish/com.edgiardina.ifpa-Signed.aab | |
- name: Deploy to Google Play (Production) | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} | |
packageName: com.edgiardina.ifpa | |
releaseFiles: bin/Release/net8.0-android34.0/publish/com.edgiardina.ifpa-Signed.aab | |
releaseName: ${{ env.VERSION }} | |
track: production | |
publish-ios: | |
runs-on: macos-15 | |
environment: Release | |
name: iOS Build | |
steps: | |
- name: Use Xcode Version | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '16.0' | |
- uses: actions/checkout@v2 | |
# https://docs.github.com/en/actions/deployment/deploying-xcode-applications/installing-an-apple-certificate-on-macos-runners-for-xcode-development | |
# github docs for installing cert and provisioning profile | |
- name: Install the Apple certificate and provisioning profile | |
env: | |
BUILD_CERTIFICATE_BASE64: ${{ secrets.DISTRIBUTION_CERT_BASE64 }} | |
P12_PASSWORD: ${{ secrets.DISTRIBUTION_CERT_PW }} | |
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.DISTRIBUTION_PROVISION_PROFILE_BASE64 }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
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 and provisioning profile from secrets | |
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode -o $PP_PATH | |
# 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: Pull Version from Tag | |
uses: nowsprinting/check-version-format-action@v3 | |
id: version | |
with: | |
prefix: 'v' | |
- name: Use Version From Tag | |
shell: bash | |
if: steps.version.outputs.is_valid == 'true' | |
run: | | |
echo "VERSION=${{steps.version.outputs.full_without_prefix}}" >> $GITHUB_ENV | |
echo "${VERSION} is our version number" | |
- name: Use Version from User Input | |
shell: bash | |
if: steps.version.outputs.is_valid == 'false' | |
run: | | |
echo "VERSION=${{github.event.inputs.versionNumber}}" >> $GITHUB_ENV | |
echo "${VERSION} is our version number" | |
- name: create a custom version using run number offset by 1000 (run_number + 1000) | |
run: | | |
echo "VERSION_NUMBER_WITH_OFFSET=$((1000+GITHUB_RUN_NUMBER))" >> $GITHUB_ENV | |
- name: App Settings Variable Substitution | |
uses: microsoft/variable-substitution@v1 | |
with: | |
files: 'appsettings.json' | |
env: | |
AppSettings.SyncFusionLicenseKey: ${{ secrets.SYNCFUSION_LICENSE_KEY }} | |
AppSettings.IfpaApiKey: ${{ secrets.IFPA_API_KEY }} | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@4d4a70f4a5b2a5a5329f13be4ac933f2c9206ac0 | |
with: | |
dotnet-version: 8.0.x | |
# The following command is due to some sort of maui build bug and iOS won't accept the binary: | |
# run: dotnet workload install ios maui --source https://api.nuget.org/v3/index.json --version 8.0.401 | |
# ITMS-91017: Invalid SDK usage - The following frameworks aren’t permitted for apps using an alternative web browser engine: [BrowserEngineKit]. | |
- name: Install MAUI Workload | |
run: dotnet workload install ios maui --source https://api.nuget.org/v3/index.json | |
- name: Restore nuget packages | |
run: dotnet restore IfpaMaui.csproj | |
# https://docs.microsoft.com/en-us/dotnet/maui/ios/deployment/overview | |
- name : Publish iOS App | |
shell: bash | |
run: | | |
dotnet publish -f net8.0-ios -c Release -p:ArchiveOnBuild=true -p:Version=${VERSION} -p:ApplicationDisplayVersion=${VERSION} -p:ApplicationVersion=${{ env.VERSION_NUMBER_WITH_OFFSET }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ifpamaui-ios-signed-build | |
if-no-files-found: error | |
path: | | |
bin/Release/net8.0-ios/**/*.ipa | |
- name: Upload app to App Store Connect | |
env: | |
APP_STORE_CONNECT_USERNAME: ${{ secrets.APP_STORE_CONNECT_USERNAME }} | |
APP_STORE_CONNECT_PASSWORD: ${{ secrets.APP_STORE_CONNECT_PASSWORD }} | |
run: | | |
xcrun altool --upload-app -t ios -f "bin/Release/net8.0-ios/ios-arm64/publish/IfpaMaui.ipa" -u "$APP_STORE_CONNECT_USERNAME" -p "$APP_STORE_CONNECT_PASSWORD" |