goreleaser-action: "failed to build for" error only in Github Action

goreleaser release --rm-dist works fine locally but when I attempt to use the Github Action I get errors like the following:

##[error]   ⨯ release failed after 0.12s error=failed to build for windows_amd64: main.go:4:2: cannot find package "github.com/foo/bar/cmd" in any of:
	/opt/hostedtoolcache/go/1.10.8/x64/src/github.com/foo/bar/cmd (from $GOROOT)
	/home/runner/go/src/github.com/foo/bar/cmd (from $GOPATH)

##[error]The process '/home/runner/work/_temp/a863cb99-f622-4bb0-8758-b06964d5df78/goreleaser' failed with exit code 1
##[error]Node run failed with exit code 1

(note I’ve replaced my repo/project with foo/bar above)

The actual “failed build” message is not always the same OS/Arch (sometimes its Linux+Arm etc).

Here is my actions file:

name: Release

on:
  push:
    branches-ignore:
      - "**"
    tags:
      - "v*.*.*"

jobs:
  goreleaser:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@master
      - name: Set up Go
        uses: actions/setup-go@master
      - name: Install upx
        run: sudo apt install upx -y
      - name: Run GoReleaser
        uses: goreleaser/goreleaser-action@v1
        with:
          version: latest
          args: release --rm-dist
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Am I missing something that I need to setup?

Also, I assum GITHUB_TOKEN is provided by the Github Actions runtime automatically?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (20 by maintainers)

Commits related to this issue

Most upvoted comments

This is a few days ago before I made those changes and looks like it is trying to run 1.10 🤷‍♂

@danawoodman That’s really strange because if you don’t use go-version for setup-go action, the latest release will be downloaded from https://golang.org/dl/?mode=json&include=all. Today it must be go1.13.4. Can you give me the logs output of your Set up Go step please?