Skip to content

Reload the user on each create event / register to make sure waiver s… #265

Reload the user on each create event / register to make sure waiver s…

Reload the user on each create event / register to make sure waiver s… #265

# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy
# More GitHub Actions for Azure: https://github.com/Azure/actions
name: TrashMob Mobile App Pull Request Build
on:
pull_request:
branches: [ "main" ]
paths:
- '.github/**'
- 'TrashMob.Models/**'
- 'TrashMobMobileApp/**'
- 'TrashMobMobileApp.sln'
env:
DOTNET_VERSION: '7.0.x' # set this to the dotnet version to use
DOTNET_VERSION2: '7.0.x' # set this to the dotnet version to use
CONFIGURATION: Debug # Values: Debug, Release
ENVIRONMENT: test # Values: test, production
IOS_BUNDLE_ID: 'eco.trashmobdev.trashmobmobile' # Values: 'eco.trashmobdev.trashmobmobile', 'eco.trashmob'
IOS_PROFILE_TYPE: 'IOS_APP_DEVELOPMENT' # Values: 'IOS_APP_DEVELOPMENT', 'IOS_APP_STORE'
jobs:
buildAndroidApp:
runs-on: windows-latest
environment: test
name: Android Build
steps:
- uses: actions/checkout@v3
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup DotNet ${{ env.DOTNET_VERSION2 }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION2 }}
- name: Install MAUI Workload
run: |
dotnet nuget locals all --clear
dotnet workload install maui --ignore-failed-sources
dotnet workload install android maui wasm-tools --source https://api.nuget.org/v3/index.json
- name: Restore Dependencies
run: |
dotnet restore TrashMobMobileApp.sln
- name: Publish Android Mobile App
run: |
dotnet publish TrashMobMobileApp.sln -c:${{ env.CONFIGURATION }} -f:net7.0-android --no-restore /p:AndroidPackageFormat="aab"
# Store Android Signing Keystore and password in Secrets using base64 encoding
# https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/certutil
# command line util to encode to base64 on windows
- name: Extract Android signing key from env
shell: bash
run: |
cd TrashMobMobileApp
mkdir android
echo "${{ secrets.ANDROID_KEYSTORE }}" > android/trashmobmobileapp.jks.base64
base64 -d android/trashmobmobileapp.jks.base64 > android/trashmobmobileapp.decrypted.jks
# check android SDK paths etc in installed VM : https://github.com/actions/virtual-environments#available-environments
- name: Sign dev build
shell: bash
run: |
cd TrashMobMobileApp
jarsigner -keystore android/trashmobmobileapp.decrypted.jks -storepass "${{ secrets.ANDROID_KEYSTORE_PASSWORD }}" -signedjar bin/${{ env.CONFIGURATION }}/net7.0-android/publish/eco.trashmob.trashmobmobileapp-Signed.aab bin/${{ env.CONFIGURATION }}/net7.0-android/publish/eco.trashmob.trashmobmobileapp.aab key
- uses: actions/[email protected]
with:
name: artifacts-android
path: |
TrashMobMobileApp\bin\${{ env.CONFIGURATION }}\net7.0-android\publish\*.aab
buildiOSApp:
runs-on: macos-13
environment: test
name: iOS Build
steps:
- uses: actions/checkout@v3
- name: Rename info.plist for Debug
run: |
rm ./TrashMobMobileApp/Platforms/iOS/Info.plist
cp ./TrashMobMobileApp/Platforms/iOS/Info-Debug.plist TrashMobMobileApp/Platforms/iOS/Info.plist
- name: Update Build Number
run: |
buildNumber=`/bin/date +%Y%m%d%H%M%S`
echo $buildNumber
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "TrashMobMobileApp/Platforms/iOS/Info.plist"
echo "checking Version number updated:"
cat TrashMobMobileApp/Platforms/iOS/Info.plist
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup DotNet ${{ env.DOTNET_VERSION2 }} Environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION2 }}
- name: Install MAUI Workload
run: |
dotnet nuget locals all --clear
dotnet workload install maui --ignore-failed-sources
dotnet workload install ios maui wasm-tools --source https://api.nuget.org/v3/index.json --ignore-failed-sources
- name: Set XCode Version
if: runner.os == 'macOS'
shell: bash
run: |
sudo xcode-select -s "/Applications/Xcode_14.3.app"
echo "MD_APPLE_SDK_ROOT=/Applications/Xcode_14.3.app" >> $GITHUB_ENV
- name: Restore Dependencies
run: |
dotnet restore TrashMobMobileApp.sln
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.IOS_CERTIFICATES_P12 }}
p12-password: ${{ secrets.IOS_CERTIFICATES_P12_PASSWORD }}
- name: Download Apple Provisioning Profiles
uses: Apple-Actions/download-provisioning-profiles@v1
with:
bundle-id: ${{ env.IOS_BUNDLE_ID }}
profile-type: ${{ env.IOS_PROFILE_TYPE }}
issuer-id: ${{ secrets.APPSTORE_ISSUER_ID }}
api-key-id: ${{ secrets.APPSTORE_KEY_ID }}
api-private-key: ${{ secrets.APPSTORE_PRIVATE_KEY }}
- name: Build MAUI iOS
run: dotnet publish TrashMobMobileApp.sln -c ${{ env.CONFIGURATION }} -f net7.0-ios -r ios-arm64 --self-contained --no-restore /p:buildForSimulator=False /p:packageApp=True /p:ArchiveOnBuild=true /p:EnableAssemblyILStripping=true /p:PublishTrimmed=true
- name: Check Artifact paths
shell: bash
run: |
pwd
#ls TrashMobMobileApp/bin/Debug/net7.0-ios/ios-arm64/publish//TrashMobMobileApp.ipa
#ls /Users/runner/work/TrashMob/TrashMob/TrashMobMobileApp/bin/Debug/net7.0-ios/ios-arm64/publish//TrashMobMobileApp.ipa
#ls /Users/runner/work/TrashMob/TrashMob/TrashMobMobileApp/bin/Debug/net7.0-ios/ios-arm64/*
#ls /Users/runner/work/TrashMob/TrashMob/TrashMobMobileApp/bin/Debug/net7.0-ios/ios-arm64/publish/*
#ls **/*.ipa
- name: Upload iOS Artifact
uses: actions/[email protected]
with:
name: trashmobmobileapp-ios-pr-build
path: TrashMobMobileApp/bin/${{ env.CONFIGURATION }}/net7.0-ios/ios-arm64/publish//*.ipa