mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
a11156c6f4
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
1.3 KiB
1.3 KiB
Azure Pipelines
Generally there're 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
- bash: curl -sL https://git.io/goreleaser | bash
displayName: Run Goreleaser
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.