Compare commits

...
24 Commits
Author SHA1 Message Date
7c44e618e7 fix: drop the GitHub Actions cache layer, keep the tool cache lookup
Review found that the GitHub Actions cache layer cost more than it
saved. Measured on ubuntu-latest, same job, same version:

  cold: download + checksum + cosign + extract   0.93 s
  cache hit: restore the 24 MB entry             1.28 s
  first run also pays a save                    +2.26 s

It is slower than a download in every configuration measured, because a
GitHub-hosted runner reaches the release CDN in about 0.4 s for a 15 MB
archive, and the cached entry is the larger extracted directory.

It also skipped the sha256 and cosign verification on a hit, which is
the control it was supposed to protect, and the only case where it wins
on time is when cosign is installed, which is exactly the case where
skipping is wrong. It cost 875 KB (+120%) of dist/index.js for every
user and 24 MB of repository cache quota per version and platform.

The restore and save wrappers were also dead code: @actions/cache
catches everything except ValidationError internally, so the try/catch
and the ReserveCacheError classification could never run.

What remains is the runner tool cache lookup, which is what #476 asked
for, and the distribution-keyed tool name that stops a Pro binary being
returned for an OSS install.

The tool cache test asserted that two installs return the same path, but
that path is a pure function of the tool, version and architecture: it
passed even with the tool cache wiped between the calls. It now asserts
that the second install reports a tool cache hit and does not download,
and it was verified to fail when the lookup is removed.

Co-authored-by: timbretimber <105982513+timbretimber@users.noreply.github.com>
Co-authored-by: Akkuman <akkumans@qq.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4eaf86fa-a85b-41f6-8763-612acc1ccc39
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-08-29 17:56:44 -03:00
Carlos Alexandro Becker df0896bb77 Merge remote-tracking branch 'origin/master' into cache
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

# Conflicts:
#	dist/index.js
2026-08-29 15:40:18 -03:00
Carlos Alexandro BeckerandCopilot 52910df325 refactor: collapse the duplicated zip extract branches
Both branches called extractZip with the same destination after the
install rewrite, so only the source path differs now.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4eaf86fa-a85b-41f6-8763-612acc1ccc39
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-08-29 15:37:33 -03:00
Carlos Alexandro Becker 7e6b514c50 chore: update generated files
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-08-29 15:33:20 -03:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
4ec11830b6 chore(deps): bump js-yaml from 5.2.2 to 5.2.3 (#573)
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 5.2.2 to 5.2.3.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/5.2.2...5.2.3)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 5.2.2
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-29 15:32:20 -03:00
fa7c11c5a3 feat: cache the goreleaser binary
Look for GoReleaser in the runner tool cache before a download. This
makes a second use of the action in the same job, or any job on a
self-hosted runner, install immediately.

Add an opt-in `cache-binary` input that also stores the binary in the
GitHub Actions cache. When it hits, the action does not download the
release archive, the checksums and the signature bundle again. Cache
errors are not fatal and fall back to a download.

The runner tool cache entry is now keyed by distribution, so a Pro
binary is no longer returned for an OSS install of the same version.

Closes #476

Co-authored-by: timbretimber <105982513+timbretimber@users.noreply.github.com>
Co-authored-by: Akkuman <akkumans@qq.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-08-29 15:19:02 -03:00
Carlos Alexandro Becker 59060fdcfd chore: update generated files
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-08-29 15:05:04 -03:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
177da47714 chore(deps): bump undici from 6.27.0 to 6.28.0 (#576)
Bumps [undici](https://github.com/nodejs/undici) from 6.27.0 to 6.28.0.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.27.0...v6.28.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 6.28.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-29 15:02:26 -03:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
a47e8c32ac chore(deps): bump the npm group with 2 updates (#574)
Bumps the npm group with 2 updates: [js-yaml](https://github.com/nodeca/js-yaml) and [yargs](https://github.com/yargs/yargs).


Updates `js-yaml` from 5.2.0 to 5.2.2
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/5.2.0...5.2.2)

Updates `yargs` from 18.0.0 to 18.1.0
- [Release notes](https://github.com/yargs/yargs/releases)
- [Changelog](https://github.com/yargs/yargs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/yargs/yargs/compare/v18.0.0...v18.1.0)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 5.2.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: yargs
  dependency-version: 18.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-29 14:57:06 -03:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
dcd4e58dba ci(deps): bump the actions group with 3 updates (#575)
Bumps the actions group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [actions/setup-go](https://github.com/actions/setup-go) and [actions/setup-node](https://github.com/actions/setup-node).


Updates `actions/checkout` from 7.0.0 to 7.0.1
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0...3d3c42e5aac5ba805825da76410c181273ba90b1)

Updates `actions/setup-go` from 6.5.0 to 7.0.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/924ae3a1cded613372ab5595356fb5720e22ba16...b7ad1dad31e06c5925ef5d2fc7ad053ef454303e)

Updates `actions/setup-node` from 6.4.0 to 7.0.0
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e...820762786026740c76f36085b0efc47a31fe5020)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/setup-go
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/setup-node
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-23 13:31:24 -03:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Carlos Alexandro Becker
57e184bc5a chore(deps): bump the npm group with 4 updates (#571)
* chore(deps): bump the npm group with 4 updates

Bumps the npm group with 4 updates: [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core), [@actions/http-client](https://github.com/actions/toolkit/tree/HEAD/packages/http-client), [js-yaml](https://github.com/nodeca/js-yaml) and [semver](https://github.com/npm/node-semver).


Updates `@actions/core` from 3.0.0 to 3.0.1
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Updates `@actions/http-client` from 4.0.0 to 4.0.1
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/http-client/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/http-client)

Updates `js-yaml` from 4.3.0 to 5.2.0
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/compare/4.3.0...5.2.0)

Updates `semver` from 7.7.4 to 7.8.5
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/main/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v7.7.4...v7.8.5)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-version: 3.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: "@actions/http-client"
  dependency-version: 4.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: js-yaml
  dependency-version: 5.2.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: npm
- dependency-name: semver
  dependency-version: 7.8.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm
...

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

* fix: updates

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-07-01 14:35:34 -03:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
ed0d97425c ci(deps): bump the actions group with 3 updates (#570)
Bumps the actions group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [actions/setup-go](https://github.com/actions/setup-go) and [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `actions/checkout` from 6.0.3 to 7.0.0
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/df4cb1c069e1874edd31b4311f1884172cec0e10...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0)

Updates `actions/setup-go` from 6.4.0 to 6.5.0
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](https://github.com/actions/setup-go/compare/4a3601121dd01d1626a1e23e37211e3254c1c06c...924ae3a1cded613372ab5595356fb5720e22ba16)

Updates `codecov/codecov-action` from 6.0.1 to 7.0.0
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/e79a6962e0d4c0c17b229090214935d2e33f8354...fb8b3582c8e4def4969c97caa2f19720cb33a72f)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/setup-go
  dependency-version: 6.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: codecov/codecov-action
  dependency-version: 7.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-01 14:16:38 -03:00
Carlos Alexandro Becker f06c13b6b1 chore: update dist
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-06-27 14:51:50 -03:00
Carlos Alexandro Becker d3934597ca ci: fix job
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-06-27 14:48:55 -03:00
Carlos Alexandro Becker ee731b1700 chore: workflow dispatch
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-06-27 14:04:48 -03:00
Carlos Alexandro Becker 55de448558 chore(deps): bump js-yaml from 4.1.1 to 4.2.0
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-06-27 14:03:18 -03:00
a4f614e65e ci: use a GitHub App token to rebuild dist on dependabot PRs (#569)
* ci: use a GitHub App token to rebuild dist on dependabot PRs

Replaces GH_PAT (a broad org PAT) with a GitHub App token for pushing the
rebuilt dist/ back to Dependabot PR branches. An App token is scoped to
this repo with minimal permissions and is short-lived, so it is much safer
to expose on the (semi-trusted) Dependabot PR build than a wide PAT.

The job stays a no-op until the DIST_REBUILD_APP_ID and
DIST_REBUILD_APP_PRIVATE_KEY Dependabot secrets are configured.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* ci: use GORELEASER_APP_ID/GORELEASER_APP_KEY for dist rebuild

Use the existing GoReleaser GitHub App secrets instead of dedicated
DIST_REBUILD_* ones.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-27 10:26:46 -03:00
d2d17a6c5d ci: auto-rebuild dist on dependabot PRs (#568)
Adds a workflow that, on Dependabot PRs, rebuilds the ncc-bundled dist/
and pushes it back onto the PR branch, so a dependency bump and its
matching dist/ land in a single PR and the validate workflow stays green.

Pushing the dist commit uses GH_PAT (the default GITHUB_TOKEN is read-only
on Dependabot runs and its pushes do not re-trigger checks). The job is a
no-op until GH_PAT is available as a Dependabot secret.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-24 11:40:21 -03:00
d13def3a6e build: regenerate dist after undici 6.27.0 bump (#567)
The undici 6.24.1 -> 6.27.0 bump (#565) updated package-lock.json but
did not regenerate the bundled dist/index.js. The validate workflow's
build job rebuilds dist/ and fails on any uncommitted changes, which
broke CI on master.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-06-24 10:43:30 -03:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
21549b6bea chore(deps): bump undici from 6.24.1 to 6.27.0 (#565)
Bumps [undici](https://github.com/nodejs/undici) from 6.24.1 to 6.27.0.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.24.1...v6.27.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 6.27.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-24 08:53:51 -03:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
47c416d5e8 ci(deps): bump the actions group with 3 updates (#563)
Bumps the actions group with 3 updates: [actions/checkout](https://github.com/actions/checkout), [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer) and [codecov/codecov-action](https://github.com/codecov/codecov-action).


Updates `actions/checkout` from 6.0.2 to 6.0.3
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/de0fac2e4500dabe0009e67214ff5f5447ce83dd...df4cb1c069e1874edd31b4311f1884172cec0e10)

Updates `sigstore/cosign-installer` from 4.1.1 to 4.1.2
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/cad07c2e89fa2edd6e2d7bab4c1aa38e53f76003...6f9f17788090df1f26f669e9d70d6ae9567deba6)

Updates `codecov/codecov-action` from 6.0.0 to 6.0.1
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/57e3a136b779b570ffcdbf80b3bdc90e7fab3de2...e79a6962e0d4c0c17b229090214935d2e33f8354)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: sigstore/cosign-installer
  dependency-version: 4.1.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: codecov/codecov-action
  dependency-version: 6.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-04 23:10:52 -03:00
CopilotGitHubcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
5daf1e915a fix: nightly resolution to select newest published release (#562)
* fix(nightly): pick latest nightly by published_at

GitHub's /releases endpoint is not reliably ordered by published_at,
so resolveNightly could pick an older nightly than the most recent
one. Filter, sort by published_at desc, and take the first.

* test(nightly): add regression coverage for release ordering

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2026-05-18 21:38:28 -03:00
Carlos Alexandro Becker 5cc7ebb73d ci: update actions
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2026-05-02 13:23:47 -03:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
702f5f91c9 ci(deps): bump the actions group with 3 updates (#560)
Bumps the actions group with 3 updates: [sigstore/cosign-installer](https://github.com/sigstore/cosign-installer), [actions/upload-artifact](https://github.com/actions/upload-artifact) and [actions/setup-node](https://github.com/actions/setup-node).


Updates `sigstore/cosign-installer` from 3.9.2 to 4.1.1
- [Release notes](https://github.com/sigstore/cosign-installer/releases)
- [Commits](https://github.com/sigstore/cosign-installer/compare/d58896d6a1865668819e1d91763c7751a165e159...cad07c2e89fa2edd6e2d7bab4c1aa38e53f76003)

Updates `actions/upload-artifact` from 7.0.0 to 7.0.1
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/bbbca2ddaa5d8feaa63e36b76fdaad77386f024f...043fb46d1a93c77aae656e7c1c64a875d1fc6a0a)

Updates `actions/setup-node` from 5.0.0 to 6.4.0
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/a0853c24544627f65ddf259abe73b1d18a591444...48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e)

---
updated-dependencies:
- dependency-name: sigstore/cosign-installer
  dependency-version: 4.1.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/setup-node
  dependency-version: 6.4.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-05-02 12:25:51 -03:00
12 changed files with 318 additions and 189 deletions
+41 -69
View File
@@ -37,25 +37,21 @@ jobs:
- goreleaser - goreleaser
- goreleaser-pro - goreleaser-pro
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
fetch-depth: 0 fetch-depth: 0
- - name: Set up Go
name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with: with:
go-version: stable go-version: stable
- - name: Check
name: Check
uses: ./ uses: ./
with: with:
version: ${{ matrix.version }} version: ${{ matrix.version }}
args: check --verbose args: check --verbose
workdir: ./test workdir: ./test
- - name: GoReleaser
name: GoReleaser
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }} if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
uses: ./ uses: ./
env: env:
@@ -81,30 +77,25 @@ jobs:
- true - true
- false - false
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
fetch-depth: 0 fetch-depth: 0
- - name: Set up Go
name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with: with:
go-version: 1.18 go-version: 1.18
- - name: Install cosign
name: Install cosign
if: matrix.cosign if: matrix.cosign
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2 uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
- - name: GoReleaser
name: GoReleaser
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }} if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
uses: ./ uses: ./
with: with:
distribution: ${{ matrix.distribution }} distribution: ${{ matrix.distribution }}
version: ${{ matrix.version }} version: ${{ matrix.version }}
install-only: true install-only: true
- - name: Check
name: Check
if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }} if: ${{ !(github.event_name == 'pull_request' && matrix.distribution == 'goreleaser-pro') }}
run: | run: |
goreleaser check --verbose goreleaser check --verbose
@@ -120,25 +111,21 @@ jobs:
- macos-latest - macos-latest
- windows-latest - windows-latest
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
fetch-depth: 0 fetch-depth: 0
- - name: Set up Go
name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with: with:
go-version: 1.18 go-version: 1.18
- - name: Import GPG key
name: Import GPG key
id: import_gpg id: import_gpg
uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0 uses: crazy-max/ghaction-import-gpg@2dc316deee8e90f13e1a351ab510b4d5bc0c82cd # v7.0.0
with: with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY_TEST }} gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY_TEST }}
passphrase: ${{ secrets.PASSPHRASE_TEST }} passphrase: ${{ secrets.PASSPHRASE_TEST }}
- - name: Check
name: Check
uses: ./ uses: ./
with: with:
version: latest version: latest
@@ -146,8 +133,7 @@ jobs:
workdir: ./test workdir: ./test
env: env:
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- - name: GoReleaser
name: GoReleaser
uses: ./ uses: ./
with: with:
version: latest version: latest
@@ -159,31 +145,26 @@ jobs:
upload-artifact: upload-artifact:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
fetch-depth: 0 fetch-depth: 0
- - name: Set up Go
name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with: with:
go-version: 1.18 go-version: 1.18
- - name: Check
name: Check
uses: ./ uses: ./
with: with:
args: check --verbose args: check --verbose
workdir: ./test workdir: ./test
- - name: GoReleaser
name: GoReleaser
uses: ./ uses: ./
with: with:
args: release --skip=publish --clean --snapshot args: release --skip=publish --clean --snapshot
workdir: ./test workdir: ./test
- - name: Upload assets
name: Upload assets uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with: with:
name: myapp name: myapp
path: ./test/dist/* path: ./test/dist/*
@@ -191,24 +172,20 @@ jobs:
dist: dist:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
fetch-depth: 0 fetch-depth: 0
- - name: Set up Go
name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with: with:
go-version: 1.18 go-version: 1.18
- - name: GoReleaser
name: GoReleaser
uses: ./ uses: ./
with: with:
args: release --config .goreleaser-dist.yml --skip=publish --clean --snapshot args: release --config .goreleaser-dist.yml --skip=publish --clean --snapshot
workdir: ./test workdir: ./test
- - name: Check dist
name: Check dist
run: | run: |
tree -nh ./test/_output tree -nh ./test/_output
@@ -225,18 +202,15 @@ jobs:
- goreleaser-pro - goreleaser-pro
- goreleaser - goreleaser
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
fetch-depth: 0 fetch-depth: 0
- - name: Set up Go
name: Set up Go uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
with: with:
go-version: 1.18 go-version: 1.18
- - name: GoReleaser
name: GoReleaser
uses: ./ uses: ./
with: with:
install-only: true install-only: true
@@ -244,10 +218,8 @@ jobs:
version: nightly version: nightly
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Check
name: Check
run: | run: |
goreleaser check -f ./test/.goreleaser.yml goreleaser check -f ./test/.goreleaser.yml
goreleaser --version goreleaser --version
goreleaser --version | grep nightly goreleaser --version | grep nightly
+5 -9
View File
@@ -28,19 +28,15 @@ jobs:
tag: tag:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
fetch-depth: 0 fetch-depth: 0
- - name: Git config
name: Git config
run: | run: |
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- - name: Move ${{ github.event.inputs.major_version }} to ${{ github.event.inputs.target }}
name: Move ${{ github.event.inputs.major_version }} to ${{ github.event.inputs.target }}
run: git tag -f ${{ github.event.inputs.major_version }} ${{ github.event.inputs.target }} run: git tag -f ${{ github.event.inputs.major_version }} ${{ github.event.inputs.target }}
- - name: Push
name: Push
run: git push origin ${{ github.event.inputs.major_version }} --force run: git push origin ${{ github.event.inputs.major_version }} --force
+10 -16
View File
@@ -19,30 +19,24 @@ jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: with:
fetch-depth: 0 fetch-depth: 0
- - name: Setup Node.js
name: Setup Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v6.0.0
with: with:
node-version-file: '.node-version' node-version-file: '.node-version'
cache: npm cache: npm
- - name: Install cosign
name: Install cosign uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
uses: sigstore/cosign-installer@d58896d6a1865668819e1d91763c7751a165e159 # v3.9.2 - name: Install dependencies
-
name: Install dependencies
run: npm ci run: npm ci
- - name: Test
name: Test
run: npm test run: npm test
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Upload coverage
name: Upload coverage uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
with: with:
files: ./coverage/clover.xml files: ./coverage/clover.xml
+22 -37
View File
@@ -19,45 +19,35 @@ jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
name: Setup Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v6.0.0
with: with:
node-version-file: '.node-version' node-version-file: '.node-version'
cache: npm cache: npm
- - name: Install dependencies
name: Install dependencies
run: npm ci run: npm ci
- - name: Format check
name: Format check
run: npm run format-check run: npm run format-check
- - name: Lint
name: Lint
run: npm run lint run: npm run lint
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6.0.0
name: Setup Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v6.0.0
with: with:
node-version-file: '.node-version' node-version-file: '.node-version'
cache: npm cache: npm
- - name: Install dependencies
name: Install dependencies
run: npm ci --ignore-scripts run: npm ci --ignore-scripts
- - name: Rebuild dist
name: Rebuild dist
run: npm run build run: npm run build
- - name: Compare dist
name: Compare dist
id: diff id: diff
run: | run: |
if [ "$(git diff --ignore-space-at-eol dist | wc -l)" -gt "0" ]; then if [ "$(git diff --ignore-space-at-eol dist | wc -l)" -gt "0" ]; then
@@ -65,10 +55,9 @@ jobs:
git diff dist git diff dist
exit 1 exit 1
fi fi
- - name: Upload built dist on failure
name: Upload built dist on failure
if: ${{ failure() && steps.diff.conclusion == 'failure' }} if: ${{ failure() && steps.diff.conclusion == 'failure' }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with: with:
name: dist name: dist
path: dist path: dist
@@ -76,20 +65,16 @@ jobs:
vendor: vendor:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- - name: Checkout
name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Setup Node.js
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6.0.0
name: Setup Node.js
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v6.0.0
with: with:
node-version-file: '.node-version' node-version-file: '.node-version'
cache: npm cache: npm
- - name: Refresh package-lock.json
name: Refresh package-lock.json
run: npm install --package-lock-only run: npm install --package-lock-only
- - name: Compare package-lock.json
name: Compare package-lock.json
run: | run: |
if [ -n "$(git status --porcelain -- package-lock.json)" ]; then if [ -n "$(git status --porcelain -- package-lock.json)" ]; then
echo "package-lock.json is out of sync with package.json. Run 'npm install' and commit." >&2 echo "package-lock.json is out of sync with package.json. Run 'npm install' and commit." >&2
+22
View File
@@ -21,6 +21,7 @@ ___
* [Signing](#signing) * [Signing](#signing)
* [Upload artifacts](#upload-artifacts) * [Upload artifacts](#upload-artifacts)
* [Install Only](#install-only) * [Install Only](#install-only)
* [Cache the binary](#cache-the-binary)
* [Customizing](#customizing) * [Customizing](#customizing)
* [inputs](#inputs) * [inputs](#inputs)
* [outputs](#outputs) * [outputs](#outputs)
@@ -217,6 +218,27 @@ steps:
run: goreleaser -v run: goreleaser -v
``` ```
### Cache the binary
The action looks for GoReleaser in the [runner tool cache][toolcache] before it
downloads. A second use of the action in the same job, or any job on a
self-hosted runner that already has the version, installs immediately.
A binary taken from the tool cache is not verified again, because the checksum
and the cosign signature were verified when it was first written. On a
self-hosted runner the tool cache is kept between jobs, so it must be trusted
like the runner itself. GitHub-hosted runners start with an empty tool cache in
every job, so they always download and verify.
The action does not use the [GitHub Actions cache][ghcache]. It was measured and
it is slower than a download: restoring the 24 MB entry takes about 1.3 s, while
downloading, verifying the checksum, verifying the cosign signature and
extracting the release takes about 0.9 s on a GitHub-hosted runner. It would
also skip the verification it is supposed to protect.
[toolcache]: https://github.com/actions/toolkit/tree/main/packages/tool-cache
[ghcache]: https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/cache-dependencies
## Customizing ## Customizing
### inputs ### inputs
+13
View File
@@ -104,3 +104,16 @@ describe('getRelease', () => {
); );
}); });
}); });
describe('latestNightlyRelease', () => {
it('returns the newest nightly by published_at even when API order is wrong', () => {
const release = github.latestNightlyRelease([
{tag_name: 'v2.16.0-c9b458fa-nightly', published_at: '2026-05-12T01:27:50Z'},
{tag_name: 'v2.16.0-6724de64-nightly', published_at: '2026-05-13T01:32:53Z'},
{tag_name: 'v2.16.0-2827930b-nightly', published_at: '2026-05-17T01:34:11Z'},
{tag_name: 'v2.15.4', published_at: '2026-04-21T14:07:57Z'}
]);
expect(release?.tag_name).toEqual('v2.16.0-2827930b-nightly');
});
});
+32
View File
@@ -57,6 +57,38 @@ describe('install', () => {
const bin = await goreleaser.install('goreleaser-pro', 'latest'); const bin = await goreleaser.install('goreleaser-pro', 'latest');
expect(fs.existsSync(bin)).toBe(true); expect(fs.existsSync(bin)).toBe(true);
}, 100000); }, 100000);
it('reuses the runner tool cache instead of downloading again', async () => {
const first = await goreleaser.install('goreleaser', 'v2.15.3');
const written: string[] = [];
const stdout = process.stdout.write.bind(process.stdout);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
process.stdout.write = ((chunk: any, ...rest: any[]): boolean => {
written.push(chunk.toString());
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return (stdout as any)(chunk, ...rest);
}) as typeof process.stdout.write;
let second: string;
try {
second = await goreleaser.install('goreleaser', 'v2.15.3');
} finally {
process.stdout.write = stdout;
}
const logs = written.join('');
expect(logs).toContain('found in the runner tool cache');
expect(logs).not.toContain('Downloading https://github.com/goreleaser');
expect(second).toEqual(first);
expect(fs.existsSync(second)).toBe(true);
}, 100000);
it('does not share the tool cache between distributions', async () => {
const oss = await goreleaser.install('goreleaser', 'v2.15.3');
const pro = await goreleaser.install('goreleaser-pro', 'v2.15.3');
expect(pro).not.toEqual(oss);
expect(fs.existsSync(pro)).toBe(true);
}, 100000);
}); });
describe('distribSuffix', () => { describe('distribSuffix', () => {
Generated Vendored
+8 -8
View File
File diff suppressed because one or more lines are too long
+127 -28
View File
@@ -7,13 +7,13 @@
"name": "goreleaser-action", "name": "goreleaser-action",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^3.0.0", "@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0", "@actions/exec": "^3.0.0",
"@actions/http-client": "^4.0.0", "@actions/http-client": "^4.0.1",
"@actions/tool-cache": "^4.0.0", "@actions/tool-cache": "^4.0.0",
"js-yaml": "^4.1.1", "js-yaml": "^5.2.3",
"semver": "^7.7.4", "semver": "^7.8.5",
"yargs": "^18.0.0" "yargs": "^18.1.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^24.0.0", "@types/node": "^24.0.0",
@@ -34,9 +34,9 @@
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
"version": "3.0.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.1.tgz",
"integrity": "sha512-zYt6cz+ivnTmiT/ksRVriMBOiuoUpDCJJlZ5KPl2/FRdvwU3f7MPh9qftvbkXJThragzUZieit2nyHUyw53Seg==", "integrity": "sha512-a6d/Nwahm9fliVGRhdhofo40HjHQasUPusmc7vBfyky+7Z+P2A1J68zyFVaNcEclc/Se+eO595oAr5nwEIoIUA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/exec": "^3.0.0", "@actions/exec": "^3.0.0",
@@ -53,9 +53,9 @@
} }
}, },
"node_modules/@actions/http-client": { "node_modules/@actions/http-client": {
"version": "4.0.0", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz", "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.1.tgz",
"integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==", "integrity": "sha512-+Nvd1ImaOZBSoPbsUtEhv+1z99H12xzncCkz0a3RuehINE81FZSe2QTj3uvAPTcJX/SCzUQHQ0D1GrPMbrPitg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"tunnel": "^0.0.6", "tunnel": "^0.0.6",
@@ -685,6 +685,29 @@
"concat-map": "0.0.1" "concat-map": "0.0.1"
} }
}, },
"node_modules/@eslint/eslintrc/node_modules/js-yaml": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
"integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/puzrin"
},
{
"type": "github",
"url": "https://github.com/sponsors/nodeca"
}
],
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/@eslint/eslintrc/node_modules/minimatch": { "node_modules/@eslint/eslintrc/node_modules/minimatch": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -2757,6 +2780,29 @@
"concat-map": "0.0.1" "concat-map": "0.0.1"
} }
}, },
"node_modules/eslint/node_modules/js-yaml": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.3.0.tgz",
"integrity": "sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==",
"dev": true,
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/puzrin"
},
{
"type": "github",
"url": "https://github.com/sponsors/nodeca"
}
],
"license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
"bin": {
"js-yaml": "bin/js-yaml.js"
}
},
"node_modules/eslint/node_modules/minimatch": { "node_modules/eslint/node_modules/minimatch": {
"version": "3.1.2", "version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
@@ -3093,9 +3139,9 @@
} }
}, },
"node_modules/get-east-asian-width": { "node_modules/get-east-asian-width": {
"version": "1.4.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz", "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz",
"integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==", "integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=18" "node": ">=18"
@@ -4217,15 +4263,25 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/js-yaml": { "node_modules/js-yaml": {
"version": "4.1.1", "version": "5.2.3",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-5.2.3.tgz",
"integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", "integrity": "sha512-n+mUVyUX5bVv7G/G2zyIHOhdxfuU1dY2NOFzTQUWiMUbFss8b57NFlgCCaggU78wSw5KVS9cllzeLyzyR+n5nw==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/puzrin"
},
{
"type": "github",
"url": "https://github.com/sponsors/nodeca"
}
],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"argparse": "^2.0.1" "argparse": "^2.0.1"
}, },
"bin": { "bin": {
"js-yaml": "bin/js-yaml.js" "js-yaml": "bin/js-yaml.mjs"
} }
}, },
"node_modules/jsesc": { "node_modules/jsesc": {
@@ -5058,9 +5114,9 @@
} }
}, },
"node_modules/semver": { "node_modules/semver": {
"version": "7.7.4", "version": "7.8.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz",
"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==",
"license": "ISC", "license": "ISC",
"bin": { "bin": {
"semver": "bin/semver.js" "semver": "bin/semver.js"
@@ -5609,9 +5665,9 @@
} }
}, },
"node_modules/undici": { "node_modules/undici": {
"version": "6.24.1", "version": "6.28.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.24.1.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-6.28.0.tgz",
"integrity": "sha512-sC+b0tB1whOCzbtlx20fx3WgCXwkW627p4EA9uM+/tNNPkSS+eSEld6pAs9nDv7WbY1UUljBMYPtu9BCOrCWKA==", "integrity": "sha512-LIY910g9TI13YS95lrMFrs8Rm/u/irgHeTWoKCoteeJ04CUJ92eEfj0rVn+7VKMPBpUPiUoBKfhNyLI23EE/KA==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=18.17" "node": ">=18.17"
@@ -5824,15 +5880,15 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/yargs": { "node_modules/yargs": {
"version": "18.0.0", "version": "18.1.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-18.0.0.tgz", "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.1.0.tgz",
"integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==", "integrity": "sha512-2rAgRKu54VsHkqI0/tYkmluGXHD4KW7yZoycuqDQ15QOTnc2VVfy0nN/1eMhnQLO00A+dwtK20xuCnc1YGeUyg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"cliui": "^9.0.1", "cliui": "^9.0.1",
"escalade": "^3.1.1", "escalade": "^3.1.1",
"get-caller-file": "^2.0.5", "get-caller-file": "^2.0.5",
"string-width": "^7.2.0", "string-width": "^8.2.1",
"y18n": "^5.0.5", "y18n": "^5.0.5",
"yargs-parser": "^22.0.0" "yargs-parser": "^22.0.0"
}, },
@@ -5850,6 +5906,49 @@
"node": ">=12" "node": ">=12"
} }
}, },
"node_modules/yargs/node_modules/ansi-regex": {
"version": "6.2.2",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
"integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
"license": "MIT",
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/ansi-regex?sponsor=1"
}
},
"node_modules/yargs/node_modules/string-width": {
"version": "8.2.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.2.tgz",
"integrity": "sha512-GaPUh5gfdrYzqeVNZvUfT23vYYxXzKYidUcnMtJg/3rxRV63EFZy3k6xfKlmfeJD0176lnUV/Usr3XcwSvFzpg==",
"license": "MIT",
"dependencies": {
"get-east-asian-width": "^1.5.0",
"strip-ansi": "^7.1.2"
},
"engines": {
"node": ">=20"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/yargs/node_modules/strip-ansi": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
"integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
"license": "MIT",
"dependencies": {
"ansi-regex": "^6.2.2"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
}
},
"node_modules/yargs/node_modules/yargs-parser": { "node_modules/yargs/node_modules/yargs-parser": {
"version": "22.0.0", "version": "22.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz",
+5 -6
View File
@@ -23,15 +23,14 @@
], ],
"author": "CrazyMax", "author": "CrazyMax",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^3.0.0", "@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0", "@actions/exec": "^3.0.0",
"@actions/http-client": "^4.0.0", "@actions/http-client": "^4.0.1",
"@actions/tool-cache": "^4.0.0", "@actions/tool-cache": "^4.0.0",
"js-yaml": "^4.1.1", "js-yaml": "^5.2.3",
"semver": "^7.7.4", "semver": "^7.8.5",
"yargs": "^18.0.0" "yargs": "^18.1.0"
}, },
"devDependencies": { "devDependencies": {
"@types/node": "^24.0.0", "@types/node": "^24.0.0",
+9 -1
View File
@@ -28,6 +28,7 @@ const withRetry = async <T>(operation: () => Promise<T>): Promise<T> => {
export interface GitHubRelease { export interface GitHubRelease {
tag_name: string; tag_name: string;
published_at?: string;
} }
// Matches the new-style nightly release tag pattern: vX.Y.Z-<sha>-nightly // Matches the new-style nightly release tag pattern: vX.Y.Z-<sha>-nightly
@@ -37,6 +38,13 @@ export const isNightlyTag = (tag: string): boolean => {
return nightlyTagRegex.test(tag); return nightlyTagRegex.test(tag);
}; };
export const latestNightlyRelease = (releases: Array<GitHubRelease>): GitHubRelease | undefined => {
return releases
.filter(r => nightlyTagRegex.test(r.tag_name))
.sort((a, b) => (b.published_at || '').localeCompare(a.published_at || ''))
.shift();
};
export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease> => { export const getRelease = async (distribution: string, version: string): Promise<GitHubRelease> => {
if (version === 'latest') { if (version === 'latest') {
core.warning("You are using 'latest' as default version. Will lock to '~> v2'."); core.warning("You are using 'latest' as default version. Will lock to '~> v2'.");
@@ -113,7 +121,7 @@ const resolveNightly = async (distribution: string): Promise<GitHubRelease> => {
return <Array<GitHubRelease>>JSON.parse(body); return <Array<GitHubRelease>>JSON.parse(body);
}); });
const match = releases.find(r => nightlyTagRegex.test(r.tag_name)); const match = latestNightlyRelease(releases);
if (!match) { if (!match) {
throw new Error(`No '<version>-<sha>-nightly' release found in ${url}`); throw new Error(`No '<version>-<sha>-nightly' release found in ${url}`);
} }
+24 -15
View File
@@ -1,7 +1,7 @@
import * as crypto from 'crypto'; import * as crypto from 'crypto';
import * as fs from 'fs'; import * as fs from 'fs';
import * as path from 'path'; import * as path from 'path';
import yaml from 'js-yaml'; import * as yaml from 'js-yaml';
import * as context from './context'; import * as context from './context';
import * as github from './github'; import * as github from './github';
import * as core from '@actions/core'; import * as core from '@actions/core';
@@ -11,40 +11,49 @@ import * as tc from '@actions/tool-cache';
export async function install(distribution: string, version: string): Promise<string> { export async function install(distribution: string, version: string): Promise<string> {
const release: github.GitHubRelease = await github.getRelease(distribution, version); const release: github.GitHubRelease = await github.getRelease(distribution, version);
const tag = release.tag_name;
const toolVersion = tag.replace(/^v/, '');
const toolPath = tc.find(distribution, toolVersion);
if (toolPath) {
core.info(`GoReleaser ${tag} found in the runner tool cache: ${toolPath}`);
return getExePath(toolPath);
}
const filename = getFilename(distribution); const filename = getFilename(distribution);
const baseUrl = `https://github.com/goreleaser/${distribution}/releases/download/${release.tag_name}`; const baseUrl = `https://github.com/goreleaser/${distribution}/releases/download/${tag}`;
const downloadUrl = `${baseUrl}/${filename}`; const downloadUrl = `${baseUrl}/${filename}`;
core.info(`Downloading ${downloadUrl}`); core.info(`Downloading ${downloadUrl}`);
const downloadPath: string = await tc.downloadTool(downloadUrl); const downloadPath: string = await tc.downloadTool(downloadUrl);
core.debug(`Downloaded to ${downloadPath}`); core.debug(`Downloaded to ${downloadPath}`);
await verifyChecksum(distribution, release.tag_name, downloadPath, filename); await verifyChecksum(distribution, tag, downloadPath, filename);
core.info('Extracting GoReleaser'); core.info('Extracting GoReleaser');
let extPath: string; let extPath: string;
if (context.osPlat == 'win32') { if (context.osPlat == 'win32') {
if (!downloadPath.endsWith('.zip')) { let zipPath = downloadPath;
const newPath = downloadPath + '.zip'; if (!zipPath.endsWith('.zip')) {
fs.renameSync(downloadPath, newPath); zipPath = `${downloadPath}.zip`;
extPath = await tc.extractZip(newPath); fs.renameSync(downloadPath, zipPath);
} else {
extPath = await tc.extractZip(downloadPath);
} }
extPath = await tc.extractZip(zipPath);
} else { } else {
extPath = await tc.extractTar(downloadPath); extPath = await tc.extractTar(downloadPath);
} }
core.debug(`Extracted to ${extPath}`); core.debug(`Extracted to ${extPath}`);
const cachePath: string = await tc.cacheDir(extPath, 'goreleaser-action', release.tag_name.replace(/^v/, '')); const cachePath: string = await tc.cacheDir(extPath, distribution, toolVersion);
core.debug(`Cached to ${cachePath}`); core.debug(`Cached to ${cachePath}`);
const exePath: string = path.join(cachePath, context.osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser'); return getExePath(cachePath);
core.debug(`Exe path is ${exePath}`);
return exePath;
} }
const getExePath = (dir: string): string => {
return path.join(dir, context.osPlat == 'win32' ? 'goreleaser.exe' : 'goreleaser');
};
export async function verifyChecksum( export async function verifyChecksum(
distribution: string, distribution: string,
tag: string, tag: string,
@@ -171,7 +180,7 @@ const getFilename = (distribution: string): string => {
}; };
export async function getDistPath(yamlfile: string): Promise<string> { export async function getDistPath(yamlfile: string): Promise<string> {
const cfg = yaml.load(fs.readFileSync(yamlfile, 'utf8')); const cfg = yaml.load(fs.readFileSync(yamlfile, 'utf8')) as {dist?: string};
return cfg.dist || 'dist'; return cfg.dist || 'dist';
} }