Skip to content

TrashMobMobileApp - Dev #305

TrashMobMobileApp - Dev

TrashMobMobileApp - Dev #305

name: TrashMobMobileApp - Dev
on:
push:
branches:
- main
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: test # Values: test, production
IOS_BUNDLE_ID: 'eco.trashmobdev.trashmobmobile' # 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: '6.x'
- name: Determine Version
id: version_step # step id used as reference for output values
uses: gittools/actions/gitversion/[email protected]
- name: Set Offsets
env:
NUM: ${{ github.run_number }}
OFFSET: ${{ steps.version_step.outputs.WeightedPreReleaseNumber }}
run: |
GITHUB_RUN_NUMBER_WITH_OFFSET=$(($NUM+$OFFSET))
echo "GITHUB_RUN_NUMBER_WITH_OFFSET=$(($NUM+$OFFSET))" >> $GITHUB_ENV
echo "GITHUB_RUN_NUMBER_WITH_OFFSET=$(($NUM+$OFFSET))" >> $GITHUB_OUTPUT
- 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 }}
bundle_id: ${{ steps.expose_environment_variables.outputs.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 "bundle_id=${{ env.IOS_BUNDLE_ID }}" >> $GITHUB_ENV
echo "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.bundle_id }}
android_key_name: "upload"
define_constants: "USETEST"
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.bundle_id }}
dotnet_version: ${{ needs.exposeEnvironmentVariables.outputs.dotnet_version }}
ios_provisioning_profile_type: ${{ needs.exposeEnvironmentVariables.outputs.ios_provisioning_profile_type }}
define_constants: "USETEST"
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 }}