Skip to content

Commit

Permalink
Merge pull request #39 from nventive/dev/lebo/fix-publish-cli-pipeline
Browse files Browse the repository at this point in the history
fix: Fix package publishing in pub.dev
  • Loading branch information
lesterbotello authored Aug 14, 2024
2 parents 4c4b702 + d7f6863 commit c2fef81
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build/stage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
default: false
- name: releaseNotesArtifactName
type: string
default: $(ReleaseNotesArtifactName)
default: $(ReleaseNotesArtifactName)_$(applicationEnvironment)
- name: pathToSrc
type: string
default: '$(Build.SourcesDirectory)/src'
Expand Down
30 changes: 25 additions & 5 deletions src/cli/.azuredevops/stage-publish-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 5 additions & 5 deletions src/cli/.azuredevops/templates/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
5 changes: 5 additions & 0 deletions src/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion src/cli/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit c2fef81

Please sign in to comment.