1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-07 13:31:37 +02:00

docs: Use GoReleaser Action (#1161)

This commit is contained in:
CrazyMax 2019-09-29 16:32:25 +02:00 committed by Carlos Alexandro Becker
parent 5aae030db6
commit 8fab55b555

View File

@ -4,53 +4,65 @@ menu: true
weight: 141
---
GoReleaser can also be used within [GitHub Actions][actions].
GoReleaser can also be used within our official [GoReleaser Action][goreleaser-action] through [GitHub Actions][actions].
For detailed intructions please follow GitHub Actions [workflow syntax][syntax].
You can create a workflow for pushing your releases by putting YAML configuration to `.github/workflows/release.yml`.
You can create a workflow for pushing your releases by putting YAML
configuration to `.github/workflows/release.yml`.
Example workflow:
Below is a simple snippet to use this action in your workflow:
```yaml
name: goreleaser
on:
pull_request:
push:
tags:
- 'v*'
name: GoReleaser
jobs:
release:
name: Release
goreleaser:
runs-on: ubuntu-latest
#needs: [ test ]
steps:
- name: Check out code
uses: actions/checkout@master
- name: goreleaser
uses: docker://goreleaser/goreleaser
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: release
if: success()
-
name: Checkout
uses: actions/checkout@master
-
name: Set up Go
uses: actions/setup-go@master
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@master
with:
version: latest
args: release
```
This supports everything already supported by GoReleaser's [Docker image][docker].
Check the [install](/install) section for more details.
> For detailed intructions please follow GitHub Actions [workflow syntax][syntax].
If you need to push the homebrew tap to another repository, you'll need a
custom github token, for that, add a `GORELEASER_GITHUB_TOKEN` secret and
remove the default `GITHUB_TOKEN`. The default, auto-generated token only
has access to current the repo.
## Customizing
## What doesn't work
### Inputs
Projects that depend on `$GOPATH`. GitHub Actions override the `WORKDIR`
instruction and it seems like we can't override it.
Following inputs can be used as `step.with` keys
In the future releases we may hack something together to work around this,
but, for now, only projects using Go modules are supported.
| Name | Type | Default | Description |
|---------------|---------|-----------|------------------------------------------|
| `version` | String | `latest` | GoReleaser version. Example: `v0.117.0` |
| `args` | String | | Arguments to pass to GoReleaser |
| `key` | String | | Private key to import |
### Signing
If signing is enabled in your GoReleaser configuration, populate the
`key` input with your private key and reference the key in your signing
configuration, e.g.
```yaml
signs:
- artifacts: checksum
args: ["--batch", "-u", "<key id, fingerprint, email, ...>", "--output", "${signature}", "--detach-sign", "${artifact}"]
```
This feature is currently only compatible when using the default `gpg`
command and a private key without a passphrase.
[goreleaser-action]: https://github.com/goreleaser/goreleaser-action
[actions]: https://github.com/features/actions
[docker]: https://hub.docker.com/r/goreleaser/goreleaser
[syntax]: https://help.github.com/en/articles/workflow-syntax-for-github-actions#About-yaml-syntax-for-workflows