Skip to content

goreleaser workflow testing with --snapshot on pull_request no longer works in V4 #387

@jaqx0r

Description

@jaqx0r

Happy New Year!

In V3 and earlier, one could have the same workflow launched on a pull_request as well as a tag trigger, and in the former goreleaser-action would go into --snapshot mode to allow the config to be tested. This was good as it meant one could test changes to the config in advance of merging and tagging.

goreleaser-action@v4 seems to have regressed the feature for running with --snapshot when triggered by pull_request and not tag, breaking that feature.

https://github.com/google/mtail/actions/runs/3764076951/jobs/6398151701 is a failed run on a pull request with V4 which includes the output:

Run goreleaser/[email protected]
  with:
    version: latest
    args: release --rm-dist
    distribution: goreleaser
    workdir: .
    install-only: false
  env:
    GITHUB_TOKEN: ***
Downloading https://github.com/goreleaser/goreleaser/releases/download/v1.13.1/goreleaser_Linux_x86_64.tar.gz
Extracting GoReleaser
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/852ba213-ba3b-4f9b-9a45-711602ebb679 -f /home/runner/work/_temp/957e67b8-f4a4-461f-b458-9bff6efddef5
GoReleaser latest installed successfully
/opt/hostedtoolcache/goreleaser-action/1.13.1/x64/goreleaser release --rm-dist
  • starting release...
  • loading config file                              file=.goreleaser.yml
  • loading environment variables
  • getting and validating git state
    • building...                                    commit=cf609141417ac3163b73f892a2a9d7ec65ec3164 latest tag=v3.0.0-rc51
  ⨯ release failed after 0s                  error=git tag v3.0.0-rc51 was not made against commit cf609141417ac3163b73f892a2a9d7ec65ec3164
Error: The process '/opt/hostedtoolcache/goreleaser-action/1.13.1/x64/goreleaser' failed with exit code 1

Downgrading to V3, the workflow succeeds as see nin https://github.com/google/mtail/actions/runs/3814614109/jobs/6489047363

Run goreleaser/goreleaser-action@v3
 with:
    version: latest
    args: release --rm-dist
    distribution: goreleaser
    workdir: .
    install-only: false
  env:
    GITHUB_TOKEN: ***
Downloading https://github.com/goreleaser/goreleaser/releases/download/v1.14.0/goreleaser_Linux_x86_64.tar.gz
Extracting GoReleaser
/usr/bin/tar xz --warning=no-unknown-keyword --overwrite -C /home/runner/work/_temp/3e3e09ee-2ca5-4b64-81b1-e445da0eda22 -f /home/runner/work/_temp/b0e45051-4f2f-41ec-96bb-95d5f2109911
GoReleaser latest installed successfully
No tag found for commit 'a0a3db43'. Snapshot forced
/opt/hostedtoolcache/goreleaser-action/1.14.0/x64/goreleaser release --rm-dist --snapshot
  • starting release...
  • loading config file                              file=.goreleaser.yml
  • loading environment variables
  • getting and validating git state
    • building...                                    commit=a0a3db43fa29cc3a16c4e43e44c1dd65d961ddb2 latest tag=v3.0.0-rc51
    • pipe skipped                                   reason=disabled during snapshot mode
  • parsing tag
  • setting defaults
      • DEPRECATED: `archives.replacements` should not be used anymore, check https://goreleaser.com/deprecations#archivesreplacements for more info
  • running before hooks
    • running                                        hook=go mod download
    • took: 7s
  • snapshotting
    • building snapshot...                           version=v3.0.0-rc51-next
  • checking distribution directory
  • loading go mod information
  • build prerequisites
  • writing effective config file
...

As you can see the downgrade to V3 includes the --snapshot flag in the commandline for goreleaser, and V4 no longer adds it, causing the tag lookup error.

I presume this is related to #382 as that's intentionally changed this logic.

I'd like to preserve the behaviour in my workflow of performing a "dry" test of the goreleaser config so it isn't broken accidentally, and so that changes to the goreleaser config get correctly tested as a pull_request as well. How can I get the feature back?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions