diff --git a/src/cli/.azuredevops/stage-publish-cli.yml b/src/cli/.azuredevops/stage-publish-cli.yml index 02bcb96..c0d6ad3 100644 --- a/src/cli/.azuredevops/stage-publish-cli.yml +++ b/src/cli/.azuredevops/stage-publish-cli.yml @@ -28,39 +28,6 @@ jobs: parameters: projectDirectory: '${{ parameters.pathToSrc }}/cli' - - task: DownloadSecureFile@1 - displayName: 'Download Google Cloud Key' - condition: succeeded() - inputs: - secureFile: 'flutter_publisher_gckey.json' - name: DownloadGCloudKey - - - 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: pathToSrc: '${{ parameters.pathToSrc }}' diff --git a/src/cli/.azuredevops/templates/publish-package.yml b/src/cli/.azuredevops/templates/publish-package.yml index c8c9aa2..63252e9 100644 --- a/src/cli/.azuredevops/templates/publish-package.yml +++ b/src/cli/.azuredevops/templates/publish-package.yml @@ -13,10 +13,50 @@ steps: inputs: projectDirectory: '${{ parameters.pathToSrc }}/cli' arguments: 'pub publish --dry-run' + +- task: DownloadSecureFile@1 + displayName: 'Download Google Cloud Key' + condition: succeeded() + inputs: + secureFile: 'flutter_publisher_gckey.json' + name: DownloadGCloudKey + +- 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' + +- task: PowerShell@2 + inputs: + targetType: 'inline' + script: | + gcloud auth activate-service-account --key-file=$(DownloadGCloudKey.secureFilePath) + displayName: 'Activate service account' -- script: | - gcloud auth activate-service-account --key-file=$(DownloadGCloudKey.secureFilePath) +- script: | gcloud auth print-identity-token --audiences=https://pub.dev | dart pub token add https://pub.dev + cd ${{ parameters.pathToSrc }}/cli dart pub publish --force condition: eq(${{ parameters.dryRun }}, false) displayName: 'Flutter Pub Publish' \ No newline at end of file diff --git a/src/cli/CHANGELOG.md b/src/cli/CHANGELOG.md index d588032..a706313 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.20.3 +- (CI/CD) Fixes an authentication issue with pub.dev + ## 0.20.2 - (Template) Fixes an issue with the CLI in which the build fails during template generation because of a missing required file.