GitHub Action for GoReleaser
Go to file
dependabot[bot] de0cc32957
chore(deps): bump codecov/codecov-action from v1 to v1.0.7 (#220)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1 to v1.0.7.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Commits](https://github.com/codecov/codecov-action/compare/v1...f532c3a1452359a7f96c37efc741537b80555c74)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-06-10 21:36:17 +00:00
.github chore(deps): bump codecov/codecov-action from v1 to v1.0.7 (#220) 2020-06-10 21:36:17 +00:00
__tests__ feat: Use native GitHub Action tools to download assets and use GitHub API (#187) 2020-05-07 02:15:24 +02:00
dist Switch to Yarn (#218) 2020-06-10 21:08:02 +00:00
src Mark args input as required 2020-05-10 16:19:42 +02:00
.editorconfig Initial commit 2019-09-20 22:23:46 +02:00
.gitattributes Use ncc and clean workflows 2020-04-09 03:31:03 +02:00
.gitignore Use ncc and clean workflows 2020-04-09 03:31:03 +02:00
.goreleaser-signing.yml Use template in sign.args (#190) 2020-05-10 18:42:15 +02:00
.goreleaser.yml Remove key input and use Import GPG GitHub Action instead 2020-05-10 16:02:05 +02:00
.kodiak.toml Add kodiak 2020-05-13 23:43:51 +02:00
.prettierrc.json Update prettier 2019-11-12 00:05:29 +01:00
CHANGELOG.md Use template in sign.args 2020-05-10 18:44:39 +02:00
LICENSE feat: Use native GitHub Action tools to download assets and use GitHub API (#187) 2020-05-07 02:15:24 +02:00
README.md Bump import-gpg action 2020-05-17 23:30:07 +02:00
action.yml Mark args input as required 2020-05-10 16:19:42 +02:00
go.mod Go 1.14 2020-05-10 16:15:33 +02:00
jest.config.js feat: Use native GitHub Action tools to download assets and use GitHub API (#187) 2020-05-07 02:15:24 +02:00
main.go Initial commit 2019-09-20 22:23:46 +02:00
package.json Switch to Yarn (#218) 2020-06-10 21:08:02 +00:00
tsconfig.json Add Codecov 2020-05-07 11:47:49 +02:00
yarn.lock Switch to Yarn (#218) 2020-06-10 21:08:02 +00:00

README.md

GoReleaser Logo

GoReleaser Action

GitHub Action for GoReleaser

GitHub release GitHub marketplace Test workflow Codecov Become a sponsor


GoRelease Action

Usage

Workflow

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
      -
        name: Set up Go
        uses: actions/setup-go@v2
        with:
          go-version: 1.14
      -
        name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v2
        with:
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

IMPORTANT: note the Unshallow step. It is required for the changelog to work correctly.

Run on new tag

If you want to run GoReleaser only on new tag, you can use this event:

on:
  push:
    tags:
      - '*'

Or with a condition on GoReleaser step:

      -
        name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v2
        if: startsWith(github.ref, 'refs/tags/')
        with:
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

For detailed instructions please follow GitHub Actions workflow syntax.

Signing

If signing is enabled in your GoReleaser configuration, you can use the Import GPG GitHub Action along with this one:

      -
        name: Import GPG key
        id: import_gpg
        uses: crazy-max/ghaction-import-gpg@v2
        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 }}
          GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

And reference the fingerprint in your signing configuration using the GPG_FINGERPRINT environment variable:

signs:
  - artifacts: checksum
    args: ["--batch", "-u", "{{ .Env.GPG_FINGERPRINT }}", "--output", "${signature}", "--detach-sign", "${artifact}"]

Customizing

inputs

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
workdir String . Working directory (below repository root)

environment variables

Following environment variables can be used as step.env keys

Name Description
GITHUB_TOKEN GITHUB_TOKEN as provided by secrets

Limitation

GITHUB_TOKEN permissions are limited to the repository that contains your workflow.

If you need to push the homebrew tap to another repository, you must therefore create a custom Personal Access Token with repo permissions and add it as a secret in the repository. If you create a secret named GH_PAT, the step will look like this:

      -
        name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v2
        with:
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.GH_PAT }}

License

MIT. See LICENSE for more details.