- task: goreleaser@0 inputs: version: 'latest' distribution: 'goreleaser' args: '' workdir: '$(Build.SourcesDirectory)'
Following inputs can be used
| ||String|| ||GoReleaser distribution, either |
| ||String|| ||GoReleaser version|
| ||String||Arguments to pass to GoReleaser|
| ||String|| ||Working directory (below repository root)|
| ||Bool|| ||Just install GoReleaser|
¹ Can be a fixed version like
v0.132.0or a max satisfying semver one like
~> 0.132. In this case this will return
v0.132.1. For the
-proto the string
Task environment variables¶
... variables: - name: GORELEASER_KEY value: xxx ... or short: ... variables: GORELEASER_KEY: xxx ...
Following environment variables can be used, as environment variable.
| ||GITHUB_TOKEN for e.g. |
| ||Your GoReleaser Pro License Key, in case you are using the |
Generally there are two ways to define an Azure Pipeline: Classic pipelines defined in the UI or YAML pipelines.
Here is how to do it with YAML:
# customize trigger to your needs trigger: branches: include: - main - refs/tags/* variables: GO_VERSION: "1.17" pool: vmImage: ubuntu-latest jobs: - job: Test steps: - task: GoTool@0 inputs: version: "$(GO_VERSION)" displayName: Install Go - bash: go test ./... displayName: Run Go Tests - job: Release # only runs if Test was successful dependsOn: Test # only runs if pipeline was triggered from a branch. condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags')) steps: - task: GoTool@0 inputs: version: "$(GO_VERSION)" displayName: Install Go - task: goreleaser@0 inputs: version: 'latest' distribution: 'goreleaser' args: '' workdir: '$(Build.SourcesDirectory)'
In this example a
Test job is used to run
go test ./... to first make sure that there're no failing tests. Only if that job succeeds and the pipeline was triggered from a tag (because of the defined
condition) Goreleaser will be run.