mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
docs: GoReleaser Action v2 (#1492)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
cafc9997b0
commit
3841505619
@ -10,6 +10,10 @@ through [GitHub Actions][actions].
|
|||||||
You can create a workflow for pushing your releases by putting YAML configuration to
|
You can create a workflow for pushing your releases by putting YAML configuration to
|
||||||
`.github/workflows/release.yml`.
|
`.github/workflows/release.yml`.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
### Workflow
|
||||||
|
|
||||||
Below is a simple snippet to use this action in your workflow:
|
Below is a simple snippet to use this action in your workflow:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -36,11 +40,10 @@ jobs:
|
|||||||
go-version: 1.14
|
go-version: 1.14
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v1
|
uses: goreleaser/goreleaser-action@v2
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: release --rm-dist
|
args: release --rm-dist
|
||||||
key: ${{ secrets.YOUR_PRIVATE_KEY }}
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
@ -48,6 +51,8 @@ jobs:
|
|||||||
> **IMPORTANT**: note the `Unshallow` workflow step. It is required for the
|
> **IMPORTANT**: note the `Unshallow` workflow step. It is required for the
|
||||||
> changelog to work correctly.
|
> changelog to work correctly.
|
||||||
|
|
||||||
|
### Run on new tag
|
||||||
|
|
||||||
If you want to run GoReleaser only on new tag, you can use this event:
|
If you want to run GoReleaser only on new tag, you can use this event:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@ -62,18 +67,47 @@ Or with a condition on GoReleaser step:
|
|||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v1
|
uses: goreleaser/goreleaser-action@v2
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: release --rm-dist
|
args: release --rm-dist
|
||||||
key: ${{ secrets.YOUR_PRIVATE_KEY }}
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
```
|
```
|
||||||
|
|
||||||
> For detailed instructions please follow GitHub Actions [workflow syntax][syntax].
|
> For detailed instructions please follow GitHub Actions [workflow syntax][syntax].
|
||||||
|
|
||||||
|
### Signing
|
||||||
|
|
||||||
|
If [signing is enabled][signing] in your GoReleaser configuration, you can use the [Import GPG][import-gpg]
|
||||||
|
GitHub Action along with this one:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
-
|
||||||
|
name: Import GPG key
|
||||||
|
uses: crazy-max/ghaction-import-gpg@v1
|
||||||
|
env:
|
||||||
|
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
PASSPHRASE: ${{ secrets.PASSPHRASE }}
|
||||||
|
-
|
||||||
|
name: Run GoReleaser
|
||||||
|
uses: goreleaser/goreleaser-action@v2
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
args: release --rm-dist
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
```
|
||||||
|
|
||||||
|
And reference the userID in your signing configuration:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
signs:
|
||||||
|
- artifacts: checksum
|
||||||
|
args: ["--batch", "-u", "<key id, fingerprint, email, ...>", "--output", "${signature}", "--detach-sign", "${artifact}"]
|
||||||
|
```
|
||||||
|
|
||||||
## Customizing
|
## Customizing
|
||||||
|
|
||||||
### inputs
|
### inputs
|
||||||
@ -84,7 +118,6 @@ Following inputs can be used as `step.with` keys
|
|||||||
|---------------|---------|-----------|-------------------------------------------|
|
|---------------|---------|-----------|-------------------------------------------|
|
||||||
| `version` | String | `latest` | GoReleaser version. Example: `v0.117.0` |
|
| `version` | String | `latest` | GoReleaser version. Example: `v0.117.0` |
|
||||||
| `args` | String | | Arguments to pass to GoReleaser |
|
| `args` | String | | Arguments to pass to GoReleaser |
|
||||||
| `key` | String | | Private key to import |
|
|
||||||
| `workdir` | String | `.` | Working directory (below repository root) |
|
| `workdir` | String | `.` | Working directory (below repository root) |
|
||||||
|
|
||||||
### environment variables
|
### environment variables
|
||||||
@ -106,33 +139,19 @@ create a secret named `GH_PAT`, the step will look like this:
|
|||||||
```yaml
|
```yaml
|
||||||
-
|
-
|
||||||
name: Run GoReleaser
|
name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v1
|
uses: goreleaser/goreleaser-action@v2
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
args: release --rm-dist
|
args: release --rm-dist
|
||||||
key: ${{ secrets.YOUR_PRIVATE_KEY }}
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
|
||||||
```
|
```
|
||||||
|
|
||||||
## 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
|
[goreleaser-action]: https://github.com/goreleaser/goreleaser-action
|
||||||
[actions]: https://github.com/features/actions
|
[actions]: https://github.com/features/actions
|
||||||
[syntax]: https://help.github.com/en/articles/workflow-syntax-for-github-actions#About-yaml-syntax-for-workflows
|
[syntax]: https://help.github.com/en/articles/workflow-syntax-for-github-actions#About-yaml-syntax-for-workflows
|
||||||
|
[signing]: https://goreleaser.com/customization/#Signing
|
||||||
|
[import-gpg]: https://github.com/crazy-max/ghaction-import-gpg
|
||||||
[github-token]: https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token
|
[github-token]: https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token
|
||||||
[about-github-token]: https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#about-the-github_token-secret
|
[about-github-token]: https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token#about-the-github_token-secret
|
||||||
[pat]: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
|
[pat]: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
|
||||||
|
Loading…
Reference in New Issue
Block a user