goreleaser-action/README.md

109 lines
3.6 KiB
Markdown
Raw Normal View History

2019-09-28 18:50:20 +00:00
<p align="center">
<img alt="GoReleaser Logo" src="https://avatars2.githubusercontent.com/u/24697112?v=3&s=200" height="140" />
<h3 align="center">GoReleaser Action</h3>
<p align="center"><a href="https://github.com/features/actions">GitHub Action</a> for GoReleaser</p>
<p align="center">
<a href="https://github.com/goreleaser/goreleaser-action/releases/latest"><img alt="GitHub release" src="https://img.shields.io/github/release/goreleaser/goreleaser-action.svg?logo=github&style=flat-square"></a>
<a href="https://github.com/marketplace/actions/goreleaser-action"><img alt="GitHub marketplace" src="https://img.shields.io/badge/marketplace-goreleaser--action-blue?logo=github&style=flat-square"></a>
<a href="https://github.com/goreleaser/goreleaser-action/actions?workflow=test"><img alt="Test workflow" src="https://github.com/goreleaser/goreleaser-action/workflows/test/badge.svg"></a>
2019-11-14 22:02:06 +00:00
<a href="https://github.com/sponsors/crazy-max"><img src="https://img.shields.io/badge/sponsor-crazy--max-181717.svg?logo=github&style=flat-square" alt="Become a sponsor"></a>
2019-09-28 18:50:20 +00:00
</p>
</p>
---
2019-09-20 20:23:45 +00:00
![GoRelease Action](.github/goreleaser-action.png)
2019-09-28 18:50:20 +00:00
## Usage
2019-09-20 20:23:45 +00:00
```yaml
name: goreleaser
on:
pull_request:
push:
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Unshallow
run: git fetch --prune --unshallow
2019-09-20 20:23:45 +00:00
-
name: Set up Go
2020-05-06 21:12:22 +00:00
uses: actions/setup-go@v2
with:
2020-05-06 21:12:22 +00:00
go-version: 1.13
2019-09-20 20:23:45 +00:00
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
2019-09-20 20:23:45 +00:00
with:
version: latest
args: release --rm-dist
2019-09-26 12:17:18 +00:00
key: ${{ secrets.YOUR_PRIVATE_KEY }}
2019-09-20 21:24:04 +00:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2019-09-20 20:23:45 +00:00
```
> **IMPORTANT**: note the `Unshallow` step. It is required for the changelog to work correctly.
2020-01-20 17:47:42 +00:00
If you want to run GoReleaser only on new tag, you can use this event:
```yaml
on:
push:
tags:
- '*'
```
Or with a condition on GoReleaser step:
```yaml
-
name: Run GoReleaser
uses: goreleaser/goreleaser-action@v1
if: startsWith(github.ref, 'refs/tags/')
with:
version: latest
args: release --rm-dist
key: ${{ secrets.YOUR_PRIVATE_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
2020-01-20 17:53:25 +00:00
> For detailed instructions please follow GitHub Actions [workflow syntax](https://help.github.com/en/articles/workflow-syntax-for-github-actions#About-yaml-syntax-for-workflows).
2020-01-19 20:35:08 +00:00
2019-09-28 18:50:20 +00:00
## Customizing
2019-09-20 20:23:45 +00:00
2019-09-28 18:50:20 +00:00
### Inputs
2019-09-20 20:23:45 +00:00
Following inputs can be used as `step.with` keys
| 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 |
| `workdir` | String | `.` | Working directory (below repository root) |
2019-09-26 12:17:18 +00:00
### 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.
2019-09-29 00:40:15 +00:00
```yaml
2019-09-26 12:17:18 +00:00
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.
2019-09-20 20:23:45 +00:00
2019-09-28 18:50:20 +00:00
## License
2019-09-20 20:23:45 +00:00
MIT. See `LICENSE` for more details.