From 832aac5ad34ff77f45cb043540e22c1de18aca20 Mon Sep 17 00:00:00 2001 From: Thomas Labrecque Date: Tue, 4 Jun 2024 13:20:15 -0400 Subject: [PATCH] fix: CI Artifact Names and Android --- build/azure-pipelines.yml | 14 ++++++++------ build/stage-build.yml | 8 +++++++- build/steps-build-android.yml | 4 ++++ build/steps-build-ios.yml | 4 ++-- build/variables.yml | 5 +++-- doc/AzurePipelines.md | 10 +++++----- src/cli/CHANGELOG.md | 3 +++ 7 files changed, 32 insertions(+), 16 deletions(-) diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index bd94ab84..dc022db9 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -48,13 +48,15 @@ stages: androidArtifactName: 'GeneratedAndroidArtifact_Staging' androidKeyPropertiesFile: $(InternalKeyProperties) androidVariableGroup: 'FlutterApplicationTemplate.Distribution.Internal.Android' + iosArtifactName: 'GeneratediOSArtifact_Staging' iosProvisioningProfileFile: $(InternalProvisioningProfile) iosExportOptionsFile: $(InternalExportOptions) iosCertificateFile: $(InternalCertificate) iosVariableGroup: 'FlutterApplicationTemplate.Distribution.Internal.iOS' + releaseNotesArtifactName: 'GeneratedReleaseNotes_Staging' - stage: Publish_Template_Package - condition: and(succeeded(), eq(variables['IsLightBuild'], 'false'), eq(variables['IsReleaseBranch'], 'true')) + condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false'), eq(variables['IsReleaseBranch'], 'true')) dependsOn: - CopyTool_GeneratedApp - Build_Staging_GeneratedApp @@ -80,7 +82,7 @@ stages: BannerVersionNameText: 'STAGING' - stage: AppCenter_TestFlight_Staging - condition: and(succeeded(), eq(variables['IsLightBuild'], 'false')) + condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false')) dependsOn: Build_Staging jobs: - template: stage-release-appcenter.yml @@ -100,7 +102,7 @@ stages: - stage: Build_Production dependsOn: Build_Staging - condition: and(succeeded(), eq(variables['IsLightBuild'], 'false')) + condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false')) jobs: - template: stage-build.yml parameters: @@ -114,7 +116,7 @@ stages: iosVariableGroup: 'FlutterApplicationTemplate.Distribution.AppStore' - stage: AppCenter_Production - condition: and(succeeded(), eq(variables['IsLightBuild'], 'false')) + condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false')) dependsOn: Build_Production jobs: - template: stage-release-appcenter.yml @@ -128,7 +130,7 @@ stages: appCenterDistributionGroup: $(AppCenterDistributionGroup) - stage: AppStore - condition: and(succeeded(), eq(variables['IsLightBuild'], 'false')) + condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false')) dependsOn: Build_Production jobs: - template: stage-release-appstore.yml @@ -137,7 +139,7 @@ stages: deploymentEnvironment: AppStore - stage: GooglePlay - condition: and(succeeded(), eq(variables['IsLightBuild'], 'false')) + condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false')) dependsOn: Build_Production jobs: - template: stage-release-googleplay.yml diff --git a/build/stage-build.yml b/build/stage-build.yml index 3eef75b5..96c2bf1c 100644 --- a/build/stage-build.yml +++ b/build/stage-build.yml @@ -8,6 +8,9 @@ - name: androidArtifactName type: string default: $(AndroidArtifactName)_$(applicationEnvironment) +- name: iosArtifactName + type: string + default: $(iOSArtifactName)_$(applicationEnvironment) - name: androidKeyStoreFile type: string default: '' @@ -35,6 +38,9 @@ - name: removeHyperlinksFromReleaseNotes type: boolean default: false +- name: releaseNotesArtifactName + type: string + default: $(ReleaseNotesArtifactName) - name: pathToSrc type: string default: '$(Build.SourcesDirectory)/src' @@ -50,7 +56,7 @@ jobs: pool: vmImage : $(windowsHostedAgentImage) variables: - ArtifactName: ReleaseNotes_${{ parameters.artifactName }} + ArtifactName: ${{ parameters.releaseNotesArtifactName }} ApplicationEnvironment: ${{ parameters.applicationEnvironment }} steps: - template: steps-build-release-notes.yml diff --git a/build/steps-build-android.yml b/build/steps-build-android.yml index 0eef577b..98351ea3 100644 --- a/build/steps-build-android.yml +++ b/build/steps-build-android.yml @@ -44,6 +44,8 @@ steps: inputs: secureFile: ${{ parameters.androidKeyStorePropertiesFile }} +# TODO: If Production -> Download the google-services.json for production. + # The file copied inside the source directory must be aligned with the name chosen in '/src/app/lib/android/app/build.gradle' where 'key.properties' is loaded. - task: PowerShell@2 displayName: Copy Signing Configuration Files @@ -56,6 +58,8 @@ steps: Copy-Item -Path '$(keyStore.secureFilePath)' -Destination '${{ parameters.pathToSrc }}\app\android\app\${{ parameters.androidKeystoreFile }}' Write-Host 'Key store copied to ${{ parameters.pathToSrc }}/app/android/app/${{ parameters.androidKeystoreFile }}.' +# TODO: If Production -> Copy downloaded the google-services.json for production in the Android application folder. + - template: templates/flutter-prepare.yml parameters: projectDirectory: '${{ parameters.pathToSrc }}/app' diff --git a/build/steps-build-ios.yml b/build/steps-build-ios.yml index 89a2a668..7b007e71 100644 --- a/build/steps-build-ios.yml +++ b/build/steps-build-ios.yml @@ -96,7 +96,7 @@ steps: condition: failed() - task: Xcode@5 - condition: and(succeeded(), eq(variables['IsLightBuild'], 'false')) + condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false')) displayName: 'Xcode Archive iOS' inputs: actions: 'archive' @@ -115,7 +115,7 @@ steps: provisioningProfileName: '$(provisioningProfile.provisioningProfileName)' - task: CopyFiles@2 - condition: and(succeeded(), eq(variables['IsLightBuild'], 'false')) + condition: and(succeeded(), eq(variables['IsPullRequestBuild'], 'false')) displayName: 'Copy Binary Files' inputs: sourceFolder: '${{ parameters.pathToSrc }}/app' diff --git a/build/variables.yml b/build/variables.yml index 1956e6ee..14a0a44c 100644 --- a/build/variables.yml +++ b/build/variables.yml @@ -71,9 +71,10 @@ iOSArtifactName: iOS WindowsArtifactName: Windows TestsArtifactName: Tests + ReleaseNotesArtifactName: ReleaseNotes - # For Application.Building.Light optimizations. - IsLightBuild: $[eq(variables['Build.Reason'], 'PullRequest')] + # To know if it's a Pull Request build. + IsPullRequestBuild: $[eq(variables['Build.Reason'], 'PullRequest')] # Pipeline configuration (Disable shallow fetch). # See https://dev.to/kkazala/azure-devops-pipelines-shallow-fetch-1-is-now-default-4656 for more details. diff --git a/doc/AzurePipelines.md b/doc/AzurePipelines.md index 119a9753..a58a6f32 100644 --- a/doc/AzurePipelines.md +++ b/doc/AzurePipelines.md @@ -24,14 +24,14 @@ It also runs automated tests during the build steps. ### Pull request runs Due to the length of mobile builds, pipelines are configured to behave a little differently when building in a context of **pull request (PR) build validation**. -To reduce the build time, some stages and steps are disabled for PR builds. -This requires a specific variable called `IsLightBuild` to be set, hence why it is appearing in the pipeline. +To reduce the CI/CD utilization time, some stages and steps are disabled for PR builds. +This requires a specific variable called `IsPullRequestBuild` to be set, hence why it is appearing in the pipeline. -Also, all release stages are disabled in the context of PR build validation because, with the optimizations differences, the resulting application would not represent the real thing. +Also, all release stages are disabled in the context of PR build validation. ### Release runs -Pipeline runs **triggered on the main branch** don't qualify for `IsLightBuild` and build the application with the goal of releasing it. +Pipeline runs **triggered on the main branch** don't qualify for `IsPullRequestBuild` and build the application with the goal of releasing it. All stages are therefore enabled. ## Stages and Steps @@ -67,7 +67,7 @@ This is where the exact build steps are defined. These vary depending on the pla 1. Install and run [GitVersion](https://gitversion.net/) to calculate the semantic version based on the Git history. 1. Install the proper signing certificates (depending on the platform). 1. Build the application. -1. Archive the application (if on iOS and depending on `IsLightBuild`). +1. Archive the application (if on iOS and depending on `IsPullRequestBuild`). 1. Run the tests and publish both the test results and the code coverage results. 1. Push the built artifacts (.ipa, .aab, release notes, etc.). 1. Cleanup. diff --git a/src/cli/CHANGELOG.md b/src/cli/CHANGELOG.md index 892c3414..f6cbb4a4 100644 --- a/src/cli/CHANGELOG.md +++ b/src/cli/CHANGELOG.md @@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) Prefix your items with `(Template)` if the change is about the template and not the resulting application. +## 0.19.4 +- Fix CI/CD artifact name for iOS. + ## 0.19.2 - Cleanup documentation.