> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# hubci/goreleaser

Easily install and use GoReleaser on CircleCI. GoReleaser is a Go (Golang)
publishing and release tool. You can publish Go projects to GitHub, Brew,
Snap, and more.

Currently supports Linux and macOS on amd64 and arm64.


## Commands

### install

Install GoReleaser in a job. This command supports Linux and macOS on both amd64 and arm64. Installs to ~/bin.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `version` | string |  | The GoReleaser version. This is a full SemVer version. |

### release

Run GoReleaser. Optionally without actually publishing.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `dry-run` | boolean | false | Basically runs `goreleaser --snapshot --skip=publish --clean` for
you when true.
 |
| `config` | string | ./.goreleaser.yaml | Path to the config file. |

## Jobs

### release

Release a Go (golang) project or do a test build.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `version` | string |  | The GoReleaser version. This is a full SemVer version. |
| `go-version` | string |  | The version of Go to build with. |
| `dry-run` | boolean | false | Basically runs `goreleaser --snapshot --skip=publish --clean` for
you when true.
 |
| `image` | enum | cimg | Which image/executor technology to run with. Check the executors
shipped with this orb for possible values. Defaults to "cimg"
which uses the `cimg/go` Convenience Image.
 |
| `checkout` | boolean | true | Whether or not to run the CircleCI checkout step. |
| `config` | string | ./.goreleaser.yaml | Path to the config file. |
| `remote-docker` | boolean | false | Whether or not to enable CircleCI's remote Docker within the job. |

## Executors

### cimg

| Parameter | Type | Default | Description |
|---|---|---|---|
| `go-version` | string |  |  |

### linux

| Parameter | Type | Default | Description |
|---|---|---|---|
| `go-version` | string |  |  |

### mac

| Parameter | Type | Default | Description |
|---|---|---|---|
| `go-version` | string |  |  |

## Examples

### main

An example of how to use the job included in the GoReleaser orb.

```yaml
version: 2.1
orbs:
  gor: hubci/goreleaser@2.0
workflows:
  main-wf:
    jobs:
      - test
      - gor/release:
          version: 1.7.0
          go-version: '1.18'
          dry-run: true
  release-wf:
    jobs:
      - test:
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /^v\d+\.\d+\.\d+$/
      - gor/release:
          version: 1.7.0
          go-version: '1.18'
          filters:
            branches:
              ignore: /.*/
            tags:
              only: /^v\d+\.\d+\.\d+$/
jobs:
  test:
    docker:
      - image: cimg/go:1.18
    steps:
      - checkout
      - restore_cache:
          keys:
            - go-mod-v1
      - run:
          name: Download Dependancies
          command: cd src && go mod download
      - run:
          name: Run Tests
          command: cd src && go test
      - save_cache:
          key: go-mod-v1
          paths:
            - /go/pkg/mod
```

### custom-image

An example of how to use the job included in the GoReleaser orb but with a custom image.

```yaml
version: 2.1
orbs:
  gor: hubci/goreleaser@2.0
workflows:
  main-wf:
    jobs:
      - gor/release:
          version: 1.7.0
          go-version: '1.18'
          dry-run: true
          image: mac
```