I have a project and I'm trying to set up goreleaser using GitHub Actions. But I'm getting an error:
GoReleaser latest installed successfully v0.1.0 tag found for commit '96480db'
/opt/hostedtoolcache/goreleaser-action/1.10.2/x64/goreleaser release --rm-dist
•starting release...
• loading config file file=.goreleaser.yml
⨯release failed after 0serror=yaml: line 26: did not find expected key
Error: The process '/opt/hostedtoolcache/goreleaser-action/1.10.2/x64/goreleaser' failed with exit code 1
.goreleaser.yml
before:
hooks:
- go mod tidy
builds:
- main: cmd/gsolc-select/main.go
binary: gsolc-select
id: gsolc-select-cli
env:
- CGO_ENABLED=0
goos: [ windows,linux,darwin ]
goarch: [ amd64,386,arm,arm64 ]
ignore:
- goos: darwin
goarch: 386
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
flags:
- -trimpath
- main: cmd/solc/main.go
binary: solc
id: solc
env:
- CGO_ENABLED=0
goos: [ windows,linux,darwin ]
goarch: [ amd64,386,arm,arm64 ]
ignore:
- goos: darwin
goarch: 386
- goos: windows
goarch: arm
- goos: windows
goarch: arm64
archives:
- format: zip
id: gsolc-select
builds: [ gsolc-select-cli ]
replacements:
darwin: macOS
- format: zip
id: solc
builds: [ solc ]
replacements:
darwin: macOS
checksum:
algorithm: sha256
.github/workflows/release.yml
name: Release Binary
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: goreleaser/goreleaser-action@v3
with:
args: "release --rm-dist"
version: latest
workdir: .
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
As I understand it, the github itself provides the secrets.GITHUB_TOKEN value. I tried through settings -> secrets -> add a custom token (environment variable), but the error was the same. I can't figure out what I'm doing wrong.
Your
gorelease.yml
file has different indentations problems.I'm not familiar with GoReleaser, and the error message isn't helping, but using tools like:
goreleaser check
also returns that message.I observed that this block:
Should instead be like this:
And this other block:
Should instead be like this:
Correcting the indentation should resolve the problem. Moreover, as it doesn't seem to be related to the Github Actions workflow configurations, it should allow the workflow to run as expected.