Skip to content

Fix gitversion

Fix gitversion #614

# 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/**'
- 'TrashMobMobile/**'
- 'TrashMobMobileApp.sln'
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'
DEFINE_CONSTANTS: 'USETEST'
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: Set Build Number
id: set_build_number
run: |
buildNumber=${{ steps.version_step.outputs.semVer }}
releaseNumber=${{ steps.version_step.outputs.WeightedPreReleaseNumber }}
echo "buildNumber=${{ steps.version_step.outputs.semVer }}" >> $GITHUB_ENV
echo "buildNumber=${{ steps.version_step.outputs.semVer }}" >> $GITHUB_OUTPUT
echo "releaseNumber=${{ steps.version_step.outputs.WeightedPreReleaseNumber }}" >> $GITHUB_ENV
echo "releaseNumber=${{ steps.version_step.outputs.WeightedPreReleaseNumber }}" >> $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 }}