From d7f6863ce11b36ee4f0d8d5aea6f7bad42fc8008 Mon Sep 17 00:00:00 2001 From: Lester Botello Date: Wed, 14 Aug 2024 08:51:06 -0400 Subject: [PATCH] fix: Fix package publishing in pub.dev --- build/stage-build.yml | 2 +- src/cli/.azuredevops/stage-publish-cli.yml | 30 +++++++++++++++---- .../templates/publish-package.yml | 10 +++---- src/cli/CHANGELOG.md | 5 ++++ src/cli/pubspec.yaml | 2 +- 5 files changed, 37 insertions(+), 12 deletions(-) diff --git a/build/stage-build.yml b/build/stage-build.yml index 98c9a9e..6ebe055 100644 --- a/build/stage-build.yml +++ b/build/stage-build.yml @@ -40,7 +40,7 @@ default: false - name: releaseNotesArtifactName type: string - default: $(ReleaseNotesArtifactName) + default: $(ReleaseNotesArtifactName)_$(applicationEnvironment) - name: pathToSrc type: string default: '$(Build.SourcesDirectory)/src' diff --git a/src/cli/.azuredevops/stage-publish-cli.yml b/src/cli/.azuredevops/stage-publish-cli.yml index 19b8c21..02bcb96 100644 --- a/src/cli/.azuredevops/stage-publish-cli.yml +++ b/src/cli/.azuredevops/stage-publish-cli.yml @@ -35,11 +35,31 @@ jobs: secureFile: 'flutter_publisher_gckey.json' name: DownloadGCloudKey - - script: | - gcloud auth activate-service-account --key-file=$(DownloadGCloudKey.secureFilePath) - gcloud auth print-identity-token --audiences=https://pub.dev | dart pub token add https://pub.dev - condition: succeeded() - displayName: 'Authenticate with Google Cloud' + - task: PowerShell@2 + inputs: + targetType: 'inline' + script: | + $zipUrl = "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-windows-x86_64.zip" + $zipPath = "$(System.DefaultWorkingDirectory)\gcloud.zip" + $extractPath = "$(System.DefaultWorkingDirectory)\gcloud" + + Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath + + New-Item -ItemType Directory -Path $extractPath -Force + + Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force + + $gcloudPath = "$extractPath\google-cloud-sdk\bin\gcloud.cmd" + + $gcloudDir = [System.IO.Path]::GetDirectoryName($gcloudPath) + # [System.Environment]::SetEnvironmentVariable("PATH", $env:PATH + ";" + $gcloudDir, [System.EnvironmentVariableTarget]::Machine) + + Write-Host "##vso[task.setvariable variable=PATH;]${env:PATH};$gcloudDir"; + + Write-Host "Updated PATH: $env:PATH" + + Remove-Item -Path $zipPath -Force + displayName: 'Install Google Cloud SDK' - template: templates/publish-package.yml parameters: diff --git a/src/cli/.azuredevops/templates/publish-package.yml b/src/cli/.azuredevops/templates/publish-package.yml index c089661..c8c9aa2 100644 --- a/src/cli/.azuredevops/templates/publish-package.yml +++ b/src/cli/.azuredevops/templates/publish-package.yml @@ -14,9 +14,9 @@ steps: projectDirectory: '${{ parameters.pathToSrc }}/cli' arguments: 'pub publish --dry-run' -- task: FlutterCommand@0 - displayName: 'Flutter Pub Publish' +- script: | + gcloud auth activate-service-account --key-file=$(DownloadGCloudKey.secureFilePath) + gcloud auth print-identity-token --audiences=https://pub.dev | dart pub token add https://pub.dev + dart pub publish --force condition: eq(${{ parameters.dryRun }}, false) - inputs: - projectDirectory: '${{ parameters.pathToSrc }}/cli' - arguments: 'pub publish --force' + displayName: 'Flutter Pub Publish' \ No newline at end of file diff --git a/src/cli/CHANGELOG.md b/src/cli/CHANGELOG.md index 123b661..08735d6 100644 --- a/src/cli/CHANGELOG.md +++ b/src/cli/CHANGELOG.md @@ -5,6 +5,11 @@ 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.20.1 +- Fix CI/CD artifact name for Android. +- Fix CI/CD to install gcloud CLI Tool. +- Fix CI/CD build number + ## 0.20.0 - Configured MobSF security scan on Android and iOS for Staging and Production builds. diff --git a/src/cli/pubspec.yaml b/src/cli/pubspec.yaml index 36ac2f7..8996559 100644 --- a/src/cli/pubspec.yaml +++ b/src/cli/pubspec.yaml @@ -1,5 +1,5 @@ name: flutter_application_generator -description: A sample command-line application. +description: A starter CLI for creating apps using FlutterApplicationTemplate. version: 1.0.0 repository: https://github.com/nventive/FlutterApplicationTemplate