1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-09 13:36:56 +02:00

docs: add GoReleaser Extensions for Azure DevOps to docs (#2634)

Signed-off-by: Engin Diri <engin.diri@mail.schwarz>
This commit is contained in:
Engin Diri 2021-11-05 14:47:06 +01:00 committed by GitHub
parent a5d9254b86
commit f049015685
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,61 @@
# Azure Pipelines
Generally there're two ways to define an [Azure Pipeline](https://azure.microsoft.com/en-us/services/devops/pipelines/):
GoReleaser can also be used within our official [GoReleaser Extensions for Azure DevOps][goreleaser-extension]
through [Visual Studio marketplace][marketplace].
### Task definition
````yaml
- task: goreleaser@0
inputs:
version: 'latest'
distribution: 'goreleaser'
args: ''
workdir: '$(Build.SourcesDirectory)'
````
### Task inputs
Following inputs can be used
| Name | Type | Default | Description |
|------------------|---------|--------------|------------------------------------------------------------------|
| `distribution` | String | `goreleaser` | GoReleaser distribution, either `goreleaser` or `goreleaser-pro` |
| `version`**¹** | String | `latest` | GoReleaser version |
| `args` | String | | Arguments to pass to GoReleaser |
| `workdir` | String | `$(Build.SourcesDirectory)` | Working directory (below repository root) |
| `install-only` | Bool | `false` | Just install GoReleaser |
> **¹** Can be a fixed version like `v0.132.0` or a max satisfying semver one like `~> 0.132`. In this case this will return `v0.132.1`.
> For the `pro` version, add `-pro` to the string
### Task environment variables
```yaml
...
variables:
- name: GORELEASER_KEY
value: xxx
...
or short:
...
variables:
GORELEASER_KEY: xxx
...
```
Following environment variables can be used, as environment variable.
| Name | Description |
|------------------|---------------------------------------|
| `GITHUB_TOKEN` | [GITHUB_TOKEN](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token) for e.g. `brew` or `gofish` |
| `GORELEASER_KEY` | Your [GoReleaser Pro](https://goreleaser.com/pro) License Key, in case you are using the `goreleaser-pro` distribution |
### Example pipeline
Generally there are two ways to define an [Azure Pipeline](https://azure.microsoft.com/en-us/services/devops/pipelines/):
Classic pipelines defined in the UI or YAML pipelines.
Here is how to do it with YAML:
@ -41,9 +96,16 @@ jobs:
version: "$(GO_VERSION)"
displayName: Install Go
- bash: curl -sL https://git.io/goreleaser | bash
displayName: Run Goreleaser
- 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.
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.
[goreleaser-extension]: https://marketplace.visualstudio.com/items?itemName=GoReleaser.goreleaser
[marketplace]: https://marketplace.visualstudio.com/azuredevops