Skip to content

TrashMobMobileApp - Prod #119

TrashMobMobileApp - Prod

TrashMobMobileApp - Prod #119

# 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: TrashMobMobileApp - Prod
on:
push:
branches:
- release
paths:
- '.github/**'
- 'TrashMob.Models/**'
- 'TrashMobMobile/**'
workflow_dispatch:
env:
DOTNET_VERSION: '8.0.x' # set this to the dotnet version to use
DOTNET_VERSION2: '8.0.x' # set this to the dotnet version to use
CONFIGURATION: Release # Values: Debug, Release
ENVIRONMENT: production # Values: test, production
ANDROID_BUNDLE_ID: 'eco.trashmob.trashmobmobileapp' # Values: 'eco.trashmobdev.trashmobmobileapp', 'eco.trashmob'
IOS_BUNDLE_ID: 'eco.trashmob' # Values: 'eco.trashmobdev.trashmobmobile', 'eco.trashmob'
IOS_PROFILE_TYPE: 'IOS_APP_STORE' # Values: 'IOS_APP_DEVELOPMENT', 'IOS_APP_STORE'
jobs:
generate-build-number:
runs-on: ubuntu-latest
outputs:
buildNumber: ${{ steps.set_build_number.outputs.buildNumber }}
releaseNumber: ${{ steps.set_build_number.outputs.releaseNumber }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine Version
id: version_step # step id used as reference for output values
uses: gittools/actions/gitversion/[email protected]
- name: release number with offset
env:
NUM: ${{ github.run_number }}
RELEASENUM: ${{ steps.version_step.outputs.WeightedPreReleaseNumber }}
run: |
echo "GITHUB_RUN_NUMBER_WITH_OFFSET=$(($NUM + $RELEASENUM))" >> $GITHUB_ENV
- name: Set Build Number
id: set_build_number
run: |
buildNumber=${{ steps.version_step.outputs.semVer }}
releaseNumber=${{ env.GITHUB_RUN_NUMBER_WITH_OFFSET }}
echo "buildNumber=${{ steps.version_step.outputs.semVer }}" >> $GITHUB_ENV
echo "buildNumber=${{ steps.version_step.outputs.semVer }}" >> $GITHUB_OUTPUT
echo "releaseNumber=${{ env.GITHUB_RUN_NUMBER_WITH_OFFSET }}" >> $GITHUB_ENV
echo "releaseNumber=${{ env.GITHUB_RUN_NUMBER_WITH_OFFSET }}" >> $GITHUB_OUTPUT
exposeEnvironmentVariables:
runs-on: ubuntu-latest
name: Expose environment variables
outputs:
environment: ${{ steps.expose_environment_variables.outputs.environment }}
configuration: ${{ steps.expose_environment_variables.outputs.configuration }}
android_bundle_id: ${{ steps.expose_environment_variables.outputs.android_bundle_id }}
ios_bundle_id: ${{ steps.expose_environment_variables.outputs.ios_bundle_id }}
dotnet_version: ${{ steps.expose_environment_variables.outputs.dotnet_version }}
ios_provisioning_profile_type: ${{ steps.expose_environment_variables.outputs.ios_provisioning_profile_type }}
steps:
- name: Set environment variable outputs
id: expose_environment_variables
run: |
echo "environment=${{ env.ENVIRONMENT }}" >> $GITHUB_ENV
echo "environment=${{ env.ENVIRONMENT }}" >> $GITHUB_OUTPUT
echo "configuration=${{ env.CONFIGURATION }}" >> $GITHUB_ENV
echo "configuration=${{ env.CONFIGURATION }}" >> $GITHUB_OUTPUT
echo "android_bundle_id=${{ env.ANDROID_BUNDLE_ID }}" >> $GITHUB_ENV
echo "android_bundle_id=${{ env.ANDROID_BUNDLE_ID }}" >> $GITHUB_OUTPUT
echo "ios_bundle_id=${{ env.IOS_BUNDLE_ID }}" >> $GITHUB_ENV
echo "ios_bundle_id=${{ env.IOS_BUNDLE_ID }}" >> $GITHUB_OUTPUT
echo "dotnet_version=${{ env.DOTNET_VERSION }}" >> $GITHUB_ENV
echo "dotnet_version=${{ env.DOTNET_VERSION }}" >> $GITHUB_OUTPUT
echo "ios_provisioning_profile_type=${{ env.IOS_PROFILE_TYPE }}" >> $GITHUB_ENV
echo "ios_provisioning_profile_type=${{ env.IOS_PROFILE_TYPE }}" >> $GITHUB_OUTPUT
callBuildAndroid:
name: Call Android build workflow
needs: [generate-build-number, exposeEnvironmentVariables]
uses: ./.github/workflows/build-android.yml
with:
environment: ${{ needs.exposeEnvironmentVariables.outputs.environment }}
configuration: ${{ needs.exposeEnvironmentVariables.outputs.configuration }}
build_number: ${{ needs.generate-build-number.outputs.buildNumber }}
release_number: ${{ needs.generate-build-number.outputs.releaseNumber }}
dotnet_version: ${{ needs.exposeEnvironmentVariables.outputs.dotnet_version }}
bundle_id: ${{ needs.exposeEnvironmentVariables.outputs.android_bundle_id }}
version: ${{ github.event.inputs.version }}
android_key_name: "key"
define_constants: "USEPROD"
secrets:
android_keystore: ${{ secrets.ANDROID_KEYSTORE }}
android_keystore_password: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
appsettings: ${{ secrets.MOBILE_APPSETTINGS }}
android_google_apikey: ${{ secrets.ANDROID_GOOGLE_APIKEY }}
calliOSBuild:
name: Call iOS build workflow
needs: [generate-build-number, exposeEnvironmentVariables]
uses: ./.github/workflows/build-ios.yml
with:
environment: ${{ needs.exposeEnvironmentVariables.outputs.environment }}
configuration: ${{ needs.exposeEnvironmentVariables.outputs.configuration }}
build_number: ${{ needs.generate-build-number.outputs.buildNumber }}
bundle_id: ${{ needs.exposeEnvironmentVariables.outputs.ios_bundle_id }}
dotnet_version: ${{ needs.exposeEnvironmentVariables.outputs.dotnet_version }}
ios_provisioning_profile_type: ${{ needs.exposeEnvironmentVariables.outputs.ios_provisioning_profile_type }}
version: ${{ github.event.inputs.version }}
define_constants: "USEPROD"
secrets:
ios_signing_certificate: ${{ secrets.IOS_CERTIFICATES_P12 }}
ios_signing_certificate_password: ${{ secrets.IOS_CERTIFICATES_P12_PASSWORD }}
apple_issuer_id: ${{ secrets.APPSTORE_ISSUER_ID }}
apple_key_id: ${{ secrets.APPSTORE_KEY_ID }}
apple_key: ${{ secrets.APPSTORE_PRIVATE_KEY }}
appsettings: ${{ secrets.MOBILE_APPSETTINGS }}
callAndroidDeploy:
name: Call Android deploy workflow
needs: callBuildAndroid
uses: ./.github/workflows/publish-android.yml
with:
artifact_name: ${{ needs.callBuildAndroid.outputs.artifact_name }}
bundle_id: ${{ needs.callBuildAndroid.outputs.bundle_id }}
secrets:
GCP_SERVICE_ACCOUNT: ${{ secrets.GCP_SERVICE_ACCOUNT }}
calliOSDeploy:
name: Call iOS deploy workflow
needs: calliOSBuild
uses: ./.github/workflows/publish-ios.yml
with:
artifact_name: ${{ needs.calliOSBuild.outputs.artifact_name }}
secrets:
APPSTORE_ISSUER_ID: ${{ secrets.APPSTORE_ISSUER_ID }}
APPSTORE_API_KEY_ID: ${{ secrets.APPSTORE_KEY_ID }}
APPSTORE_API_PRIVATE_KEY: ${{ secrets.APPSTORE_PRIVATE_KEY }}