148 Commits
Author SHA1 Message Date
Jozef Steinhübl 0c5077e514 release: v2.2.0 (#177) 2026-03-14 10:37:27 +01:00
tcely 1255e43b02 ci: update actions for the Release new action version workflow (#175)
fix(ci): pin `actions/[email protected]` by commit hash

Support for Node.js version 24 was added in `v0.4.0`.

Also:
- pin `actions/[email protected]` by commit hash
2026-03-14 10:30:47 +01:00
tcely 61861d1f6a ci: update actions for the autofix.ci workflow (#174)
fix(ci): pin `autofix-ci/[email protected]` by commit hash

Used `v1.3.2` to avoid the hostname change.

Support for Node.js version 24 is not yet available.

Also:
- pin `actions/[email protected]` by commit hash
2026-03-14 10:30:30 +01:00
tcely 6f5bd063f5 ci: use actions/[email protected] in the test workflow (#173)
fix(ci): pin `actions/[email protected]` by commit hash

Support for Node.js version 24 was added in v5.
2026-03-14 10:30:08 +01:00
e3914758a4 build: update action runtime to Node.js 24 (#176)
GitHub Actions is deprecating Node.js 20, with Node 24 becoming the
default runner on June 2, 2026. This updates the action to run on
the Node 24 runtime.

Changes:
- action.yml: node20 → node24
- esbuild target: node20 → node24
- @types/node: ^20 → ^24
- @actions/* deps bumped to their Node 24-compatible versions
  (highest CJS-compatible releases, avoiding the ESM-only latest)

The @actions/* bumps also resolve the punycode deprecation warning
(DEP0040) that Node 24 triggers with the older dependency chain.

Closes #172

Co-authored-by: Adam White <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-12 15:01:30 +01:00
Jozef Steinhüblandautofix-ci[bot] ecf28ddc73 release: v2.1.3 (#170)
* release: v2.1.3

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-03-04 16:32:45 +01:00
Wai Yan Min Lwin 95edc153a3 fix: validate cached binary version matches requested version (#146) (#169)
* fix: validate cached binary version matches requested version (#146)

* fix: fail closed when cached version cannot be verified
2026-03-04 16:27:24 +01:00
GoForceX 4c32875876 feat: add AVX2 support detection for x64 Linux systems (#167) 2026-02-28 18:08:40 +01:00
Dariel Dato-onandClaude Opus 4.6 0ff83bfc51 fix: use native Windows ARM64 binary for Bun >= 1.3.10 (#165)
Bun v1.3.10 ships native Windows ARM64 binaries. Update
getArchitecture() and getAvx2() to be version-aware so that
windows-11-arm runners download bun-windows-aarch64.zip instead of
falling back to bun-windows-x64-baseline.zip. The x64 fallback is
preserved for older versions that lack ARM64 assets.

Closes #164

Co-authored-by: Claude Opus 4.6 <[email protected]>
2026-02-26 22:21:29 +01:00
ab8cb4e8f8 feat: add bun- prefix to cache keys (#160)
* feat: add bun- prefix to cache keys

Extract cache key generation into a shared `getCacheKey` function in
utils.ts that both action.ts and cache-save.ts import.

Co-Authored-By: Claude Opus 4.5 <[email protected]>

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Claude Opus 4.5 <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-05 17:36:05 +01:00
Jozef Steinhüblandautofix-ci[bot] 196aaa2bd2 perf: avoid unnecessary api calls (#161)
* perf: avoid unnecessary api calls

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-02-05 16:04:59 +01:00
Jozef Steinhübl 3d267786b1 fix: default token only on public github (#157)
* fix: default token only on public github

* docs: document token
2026-01-16 15:46:22 +01:00
autofix-ci[bot] db6bcf6eb8 [autofix.ci] apply automated fixes 2026-01-16 03:38:02 +00:00
Jarred Sumner 4a638a4fad Bump form-data 2026-01-15 19:37:24 -08:00
563911925f feat: use packageManager from package.json as default bun version (#152)
* Initial plan

* feat: make packageManager from package.json the default bun version

Co-authored-by: xhyrom <[email protected]>

* test: improve cross-platform compatibility and cleanup in utils tests

Co-authored-by: xhyrom <[email protected]>

* docs: update README to document automatic package.json version detection

Co-authored-by: xhyrom <[email protected]>

* conflicts

* ci: setup-bun-from-package-json-without-specified-field

* ci: setup-bun-from-package-json-without-specified-field

* ci: no cache

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: xhyrom <[email protected]>
Co-authored-by: Jozef Steinhübl <[email protected]>
2026-01-05 12:45:25 +01:00
b02f8a8a6e feat: fallback arm64 to x64 architecture for win32 platform (#131)
* feat: fallback arm64 to x64 architecture for win32 platform

closes https://github.com/oven-sh/setup-bun/issues/130

* [autofix.ci] apply automated fixes

* ci: test on windows-11-arm runner

* refactor: move logic to getEffectiveArch func

* [autofix.ci] apply automated fixes

* feat: add warning message for windows arm64 fallback to x64

* [autofix.ci] apply automated fixes

* feat: don't mention arch in warning msg aboout fallback

* [autofix.ci] apply automated fixes

* debug time

* [autofix.ci] apply automated fixes

* feat: force baseline for win32 arm fallback to x64

* [autofix.ci] apply automated fixes

* ci: dont use windows-11-arm on setup bun from download url

* fix

* [autofix.ci] apply automated fixes

* fix

* [autofix.ci] apply automated fixes

* fix

* [autofix.ci] apply automated fixes

* fix

* [autofix.ci] apply automated fixes

* fix

* [autofix.ci] apply automated fixes

* apply changes

Co-authored-by: Copilot <[email protected]>

* [autofix.ci] apply automated fixes

* docs: clarify

* [autofix.ci] apply automated fixes

* test: add unit tests for getAvx2 Windows ARM64 fallback logic (#154)

* Initial plan

* Add unit tests for getAvx2 function

Co-authored-by: xhyrom <[email protected]>

* Consolidate duplicate test assertions in getAvx2 tests

Co-authored-by: xhyrom <[email protected]>

* Fix whitespace formatting in test file

Co-authored-by: xhyrom <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: xhyrom <[email protected]>

* test: add unit tests for getArchitecture and getAvx2 Windows ARM64 fallback logic (#153)

* Initial plan

* Add unit tests for getArchitecture function

Co-authored-by: xhyrom <[email protected]>

* Remove unused import in utils.spec.ts

Co-authored-by: xhyrom <[email protected]>

* Apply suggestion from @Copilot

Co-authored-by: Copilot <[email protected]>

* Merge pr-131 and resolve test file conflicts

Co-authored-by: xhyrom <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: xhyrom <[email protected]>
Co-authored-by: Jozef Steinhübl <[email protected]>
Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
2026-01-05 01:16:53 +01:00
Jozef Steinhüblandautofix-ci[bot] 8c296f9cb7 feat: implement wildcard resolution into the action (#93)
* feat: remove retry attempts

* [autofix.ci] apply automated fixes

* feat: get download url from github's api

* [autofix.ci] apply automated fixes

* fix: add token property to action definition & fix satisfies params

* [autofix.ci] apply automated fixes

* fix: getPlatform, getArchitecture + eversion

* [autofix.ci] apply automated fixes

* fix: duplicate v

* [autofix.ci] apply automated fixes

* fix: check if valid semver and add bun-v

* [autofix.ci] apply automated fixes

* refactor: wrap validation

* [autofix.ci] apply automated fixes

* ci(format): use bun

bun install is rqeuired for patches

* ci(format): use bun

bun install is rqeuired for patches

* [autofix.ci] apply automated fixes

* feat: bring back support for sha downloads

* [autofix.ci] apply automated fixes

* fix: add bearer prefix for token

* [autofix.ci] apply automated fixes

* fix: proper error when artifact is not found

* [autofix.ci] apply automated fixes

* conflicts

* autofix build

* fix

* fix

* fix

* fix

* fix

* autofix build

* fix

* [autofix.ci] apply automated fixes

* fix

* [autofix.ci] apply automated fixes

* fix

* [autofix.ci] apply automated fixes

* fix

* fix

* [autofix.ci] apply automated fixes

* fix

* fix

* [autofix.ci] apply automated fixes

* fix: drop sha support for now

* [autofix.ci] apply automated fixes

* fix: filter tags

* [autofix.ci] apply automated fixes

* docs: token

* docs: token

* docs: token

* refactor: cleanup

* [autofix.ci] apply automated fixes

* refactor: cleanup

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-01-05 00:03:34 +01:00
Jozef Steinhübl b7a1c7ccf2 release: v2.1.0 (#151)
* release: v2.1.0

* release: v2.1.0
2026-01-04 00:53:29 +01:00
bashonlyandautofix-ci[bot] ad1208bf19 docs: restore missing no-cache input (#149)
* docs: restore missing `no-cache` input

accidentally removed in ef00e4ac8e

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-01-04 00:21:55 +01:00
autofix-ci[bot] bc6f04ce3b [autofix.ci] apply automated fixes 2025-12-23 18:57:05 +00:00
Erik Axel Nielsenandautofix-ci[bot] 1dbab0699e feat: Check for existing bun before downloading (#138)
* feat: Check for existing bun before downloading

Check for existing bun with same version number, if it exists we skip any futher actions. This avoids downloading cache or bun over the network.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-12-23 19:56:47 +01:00
dgilmanuni 635640504f chore(ci): Pin GitHub Actions to SHA-1s (#140) 2025-10-09 07:20:42 +02:00
Jozef Steinhübl 22457c87c1 docs: remove unnecessary note 2025-07-10 21:09:16 +02:00
autofix-ci[bot] 237a6a77d8 [autofix.ci] apply automated fixes 2025-07-10 19:07:39 +00:00
Jozef Steinhübl 53e6487b6e ci(format): use bun 2025-07-10 21:07:00 +02:00
Jozef Steinhübl 68643ea879 ci: disable tests with version selectors (#133) 2025-07-10 21:02:01 +02:00
Jozef Steinhüblandautofix-ci[bot] 56169ab7b0 feat: read engines from package json (#132)
* feat: read engines from package.json

closes https://github.com/oven-sh/setup-bun/issues/115

* ci: test for engines package.json

* [autofix.ci] apply automated fixes

* ci: test for engines package.json

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-10 20:58:50 +02:00
Jozef Steinhüblandautofix-ci[bot] 34f777aec1 feat: support for multiple registries (#109)
* feat: support for multiple registries

* [autofix.ci] apply automated fixes

* refactor: drop unnecessary check

* fix: pass empty array instead undefined

* [autofix.ci] apply automated fixes

* fix: dont add registry set line

* [autofix.ci] apply automated fixes

* feat: few more tests

* feat: add bun types

* docs: explain registries

* feat: save globally

* [autofix.ci] apply automated fixes

* ci: jsr registry test

* ci: add ,

* ci: test

* ci: test

* ci: test

* ci: test

* [autofix.ci] apply automated fixes

* feat: use @iarna/toml

* [autofix.ci] apply automated fixes

* feat: registry parsing

* [autofix.ci] apply automated fixes

* ci: verbose add

* ci: registry install check

* ci: registry install check

* ci: registry install check

* ci: verify registry usage

* docs: registries

* docs: important block

* docs: show table

* docs: show table

* ci: shell

* ci: registry test on linux

* ci: registry test on linux

* build: text lockfile

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-07-09 12:22:12 +02:00
Okinea Dev 7c641390eb chore: add settings for vscode (#120)
* chore: update Prettier settings and add settings for vscode

* rollback semi

* fix: exclude `dist` from search and lock changes to some files

* Added `search.exclude` to ignore `dist/**` during searches.
* Configured `files.readonlyInclude` to lock changes to `dist/**`, `bun.lock`, and `package-lock.json`.
2025-07-08 15:29:27 +02:00
autofix-ci[bot] 735343b667 [autofix.ci] apply automated fixes 2025-04-27 13:53:50 +00:00
Jozef Steinhübl 27ecfffdee ci: update autofix ci 2025-04-27 15:53:25 +02:00
Afonso Jorge Ramos fcc30ed971 fix(docs): remove wildcard in version (#124)
until https://github.com/oven-sh/setup-bun/issues/37 gets fixed
2025-04-27 15:48:05 +02:00
Jozef Steinhübl 56408e9a3f release: v2.0.2 2025-04-27 15:47:24 +02:00
Robert Michalak 85cb7f6e7e build: bump @actions/cache version (#128)
* bump @actions/cache version

* fix runtime error
2025-04-27 15:46:35 +02:00
Okinea Dev 54cb141c5c ci: remove unnecessary steps & cleanup (#118)
* refactor(ci): refactor GitHub Actions for better readablility

* upd

* remove ""
2025-02-04 18:31:38 +01:00
Okinea Dev 6fb6603cc1 build: use text-based Bun lockfile (#116)
chore: 🔒 use text-based Bun lockfile

Support for the text lockfile format was introduced in version `1.1.40` (https://bun.sh/blog/bun-v1.1.40), it will soon replace the binary lockfile format `.lockb` in the upcoming version `1.2.0`

In addition, cached bun install will become 30% faster thanks to the text-based lockfile format - https://bun.sh/blog/bun-lock-text-lockfile#cached-bun-install-gets-30-faster

Read https://bun.sh/blog/bun-lock-text-lockfile
2025-01-05 12:45:22 +01:00
autofix-ci[bot] 9bdeab4320 [autofix.ci] apply automated fixes 2024-12-09 17:46:42 +00:00
Florian Barbare f09eb1edd0 fix: make bun resolve to given file path when an absolute path is given (#114)
* Make bun resolve to single file path when an absolute path is given

* Update test not to use the workspace folder
2024-12-09 18:46:15 +01:00
Jozef Steinhübl 8f1bc2eeb3 ci: add setup bun download url (#105)
* ci: add setup bun download url

* ci: change runs-on

* ci: aarch64, not arm64
2024-10-08 15:30:45 +02:00
a8913c42f4 fix: use hash instead of url for primary cache key (#102) (#103)
* fix: use hash instead of url for primary cache key (#102)

* Update cache-save.ts

* Update action.ts

* Update cache-save.ts

* build

* format

* [autofix.ci] apply automated fixes

---------

Co-authored-by: Daniil Zotov <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-10-08 15:19:42 +02:00
マルコメ b9d34de66d chore(docs): missing version on examples (#96) 2024-08-06 11:21:46 +02:00
Seiya Kokushiandautofix-ci[bot] 1e54087d4f fix: allow more spaces for .tool-versions (#94)
* update: allow more spaces for .tool-versions

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-30 22:30:50 +02:00
Jozef Steinhüblandautofix-ci[bot] 4bc047ad25 release: v2.0.1 (#91)
* build: bump version

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-07-15 21:09:36 +02:00
Araxeus f43b443c1c fix: bun-version-file default value (#90)
fix #89
2024-07-15 14:17:41 +02:00
autofix-ci[bot] 339e277e69 [autofix.ci] apply automated fixes 2024-06-24 13:19:56 +00:00
Jozef Steinhübl e20a54d1da docs: add bun-path & bun-download-url to outputs table 2024-06-24 15:19:27 +02:00
Jozef Steinhübl 3fcae870de docs: show correct bun-version-file examples (#86)
* docs: .bun-version

* docs: correct bun-version-file examples
2024-06-24 15:15:35 +02:00
Jozef Steinhübl 123c6c4e2f docs: use v2 version 2024-06-23 21:56:22 +02:00
ef00e4ac8e release: v2.0 🎉 (#80)
* feat: add input bun-version-file (#76)

* feat: add input for bun-version-file

* docs: update example bun version file

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>

* refactor: reduce read from file code

* [autofix.ci] apply automated fixes

* feat: read from all known files if not specified

* [autofix.ci] apply automated fixes

* fix: just continue if file doesnt exist

* [autofix.ci] apply automated fixes

* fix: return output if found version

* [autofix.ci] apply automated fixes

* fix: make whitespace in .tool-versions optional

* [autofix.ci] apply automated fixes

* log loglog

* [autofix.ci] apply automated fixes

* log log log

* [autofix.ci] apply automated fixes

* better warnings, fix ci failing

* [autofix.ci] apply automated fixes

* feat: log obtained version

* [autofix.ci] apply automated fixes

* build: bump version

* [autofix.ci] apply automated fixes

* fix: add .zip extension if it's not present

Workaround for https://github.com/actions/toolkit/issues/1179

Fixes https://github.com/oven-sh/setup-bun/issues/79

* [autofix.ci] apply automated fixes

* docs: add comment for easier understanding

* ci: more readable version

* ci: match name

* docs: add package.json and .tool-versions to bun-version-file examples

* ci: add cache test

* ci: install another pkg for cache test

* ci: install more pkgs for cache test

* ci: block all trusted deps in cache test

* ci: more deps for cache test

* ci: cache test should cache

* refactor: dont try all files if not defined

* [autofix.ci] apply automated fixes

* ci: remove cache test

* feat: support .bunrc

* [autofix.ci] apply automated fixes

* refactor: .bun-version instead .bunrc

* [autofix.ci] apply automated fixes

* feat: add bun paths and url to output

Fixes https://github.com/oven-sh/setup-bun/issues/81

* [autofix.ci] apply automated fixes

* ci: test for .bun-version

* feat: make .bun-version as default in bun-version-file

* ci: remove cache before test

* ci: remove cache before test

* ci: remove cache before test

* ci: remove cache before test

---------

Co-authored-by: Ade Hery Shopyan <[email protected]>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-06-21 21:11:16 +02:00
Jarred Sumner 43b2dc9ae8 Update README.md 2024-06-02 04:02:05 -07:00
Jarred Sumner 45d2c09359 Update README.md 2024-06-02 04:01:49 -07:00
Jarred Sumner 6ef34ab578 Update README.md 2024-06-02 04:00:50 -07:00
Jarred Sumnerandautofix-ci[bot] f4d14e03ff Add bun-download-url to actions.yml and rebuild (#83)
* Add download URL

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-06-02 03:52:40 -07:00
Jozef Steinhüblandautofix-ci[bot] 8f24390df0 fix: close immediately (#75)
* fix

* add test for outputs

* ci: use correct outputs from setup bun

* dist update

* feat: add timeout

* c

* increase

* [autofix.ci] apply automated fixes

* refactor: remove unnecesary loging, decrease retries

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-03 14:01:25 +02:00
Jozef Steinhüblandautofix-ci[bot] 932c3b236c fix: retry installing three times, add windows for testing (#72)
* ci: test windows

* ci: specify shell

* ci: we don't have >1.1.0

* fix: retry installing version three times

* [autofix.ci] apply automated fixes

* build: bump version to 1.2.1

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-02 11:24:51 +02:00
Jozef Steinhüblandautofix-ci[bot] 9e6479509b feat: support .tool-versions (#68)
* feat: support .tool-versions

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-04-02 10:26:15 +02:00
Jozef Steinhübl 194c60efc3 build: bump ci actions (#66)
* ci: update checkout

* ci: update checkout
2024-03-07 11:39:32 +01:00
Max Schwenk d3603274ac Add no-cache option (#58) 2024-02-23 11:09:38 -08:00
Andy Palmer 0f37bd8169 Move cache save to runs.post and exit early (#60) 2024-02-16 14:14:07 -08:00
Filip Czaplicki 12944059f7 Fix typo in README.md (#57) 2024-02-09 18:03:04 +01:00
Ben Limmer 8642d99a51 docs: add --frozen-lockfile to README (#52)
Many folks will copy/paste the sample code from the README directly. In CI, most people will want to enforce a frozen lockfile.
2024-02-01 17:30:42 -08:00
Jacob Hummer 40646b1808 Add GitHub action to auto-update the v1 tag (#53)
Create release.yml
2024-02-01 17:29:22 -08:00
Paul Razvan Berg 94177e527c docs: add explanatory note about setup-node (#47) 2024-01-03 11:33:26 +01:00
autofix-ci[bot] 9b21598af8 [autofix.ci] apply automated fixes 2023-12-03 12:43:51 +00:00
Jozef Steinhübl (xHyroM) c7420ae597 release: 1.1.1 2023-12-03 13:43:25 +01:00
Jozef Steinhüblandautofix-ci[bot] c0059f0222 fix: package manager (#42)
* fix: read version from package json

* [autofix.ci] apply automated fixes

* Update index.ts

* Update action.yml

* [autofix.ci] apply automated fixes

* yarn does random things

* [autofix.ci] apply automated fixes

* ci: check if version from packageManager is actually 1.0.0

* ci: bash is not javascript

* ci: use  instead ::set-output

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2023-12-03 13:42:54 +01:00
Jozef Steinhübl e900e6b108 release: 1.1 (#41)
* bump

* bump

* bump
2023-11-26 21:41:40 +01:00
Ashcon Partovi a93230df19 Various improvements and fixes to setup-bun (#40)
* Do not save cache on hit
* Support Windows (canary only)
* Support `registry-url` and `scope`
2023-11-17 15:58:17 -08:00
Vitor Gomes 830e319e28 Add auth setup for private registry with scope (#16)
feat: add auth setup to private registry with scope
2023-11-01 10:17:17 +01:00
Dan Adajian 6be87460e3 feat: support packageManager in package.json (#27) 2023-10-25 15:13:22 +02:00
CyberFlame bd26ebd2c7 build: bump nodejs to v20 (#24)
update to use nodejs as per planned deprecation of node16

https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/
2023-09-26 17:36:38 +02:00
Ashcon Partovi a1800f471a Fix missing diff 2023-09-11 13:55:59 -07:00
Ashcon Partovi 5da0b0b067 Remove node_modules, for real 2023-09-11 12:52:41 -07:00
Ashcon Partovi c34bee2511 Fix bunx (#18)
* Add symlink for bunx

* Remove node_modules, use bundled code instead

* Add revision support
2023-09-11 12:37:45 -07:00
Nilesh Suthar 67e559db2c fix: use copy instead of mv (#15)
* fix: use copy instead of mv

* fix: path does not exist
2023-09-07 19:46:23 +02:00
Ashcon Partovi 4573031972 Do not cache action releases 2023-03-01 17:36:06 -08:00
Ashcon Partovi 1c8c9a7615 Fix encoding bug with 'action:<number>' version 2023-03-01 16:49:16 -08:00
Ashcon Partovi 13974bf408 Document usage of action downloads 2023-03-01 16:01:35 -08:00
Ashcon Partovi 157143337b Make cacheHit conform to best practices for actions 2023-03-01 15:58:31 -08:00
Ashcon Partovi c7179230d0 Merge pull request #7 from oven-sh/v1-pre
Next release of setup-bun
2023-02-22 18:21:07 -08:00
Ashcon Partovi 15050a7632 Actually fix double zip issue 2023-02-22 18:19:00 -08:00
Ashcon Partovi a730821cf4 Fix double zip issue? 2023-02-22 18:11:20 -08:00
Ashcon Partovi 8c368db359 Add debug statements 2023-02-22 18:05:23 -08:00
Ashcon Partovi 41bc2e859b Do not fail-fast for action 2023-02-22 17:57:41 -08:00
Ashcon Partovi 3c2d6a32bd Use newer checkout 2023-02-22 17:56:01 -08:00
Ashcon Partovi 3f252a86a6 Fix not being added to path 2023-02-22 17:51:12 -08:00
Ashcon Partovi 9c14b74b45 Next release of setup-bun 2023-02-22 17:47:24 -08:00
Colin McDonnell ed9eb0969c chore: update artifact URL 2023-01-13 12:06:42 -08:00
Colin McDonnell 91e57dc649 chore: update artifact URL 2023-01-13 12:00:19 -08:00
Hyro 37c5fa5bfd docs: change actions owner 2023-01-12 09:00:20 +01:00
xHyroM 29cb413d63 feat: update dependencies, node 2022-10-29 10:03:51 +02:00
xHyroM 0ec953ee6d chore(README): bump version 2022-07-28 09:26:39 +02:00
xHyroM 21ca0e24af chore: bump version 2022-07-28 09:25:52 +02:00
xHyroM 673843c5ea fix: extract two times for custom urls 2022-07-28 09:19:57 +02:00
xHyroM 38a9038faf fix: extract two times for custom urls 2022-07-28 09:19:39 +02:00
xHyroM 1e0686b2cc fix: extract two times for custom urls 2022-07-28 09:18:51 +02:00
xHyroM a11484a419 chore: dont cache if customDownloadUrl 2022-07-28 09:12:02 +02:00
xHyroM fe160cf381 chore: debug 2022-07-28 08:44:36 +02:00
xHyroM dbb8e61d45 chore: debug 2022-07-28 08:42:43 +02:00
xHyroM a99ac77932 chore: build 2022-07-28 08:39:58 +02:00
xHyroM fe4b2b1cd6 chore: build 2022-07-28 08:39:00 +02:00
xHyroM 10e847eceb fix: im idiot.... 2022-07-28 08:37:15 +02:00
xHyroM b3fb4f3421 chore: debug 2022-07-28 08:35:10 +02:00
xHyroM f5a14b237f chore: debug 2022-07-28 08:31:07 +02:00
xHyroM e2c23afd2e chore: debug 2022-07-28 08:27:22 +02:00
xHyroM befdce7132 chore: debug 2022-07-28 08:27:11 +02:00
xHyroM 3c39374369 chore: debug 2022-07-28 08:26:28 +02:00
xHyroM 3e21e45aa4 chore: debug 2022-07-28 08:24:56 +02:00
xHyroM 3b03c8d63a chore: debug 2022-07-28 08:21:33 +02:00
xHyroM bc3424761e chore: debug 2022-07-28 08:21:25 +02:00
xHyroM 962df21a50 chore: debug 2022-07-28 08:16:10 +02:00
xHyroM c3404c3d6b chore(workflows/test): use ACCESS_TOKEN 2022-07-28 08:10:27 +02:00
xHyroM f391a17228 chore: use api.github.com 2022-07-28 08:06:06 +02:00
xHyroM 24c8fd036a fix: add token to install 2022-07-28 08:01:15 +02:00
xHyroM 89f6825456 fix: add token to install 2022-07-28 07:59:44 +02:00
xHyroM 079e10bfd6 fix(getGithubRelease): missing .zip 2022-07-28 07:54:35 +02:00
xHyroM 3532147424 fix: missing .js 2022-07-28 07:53:26 +02:00
xHyroM e6a8865f72 feat: custom download url, custom repository 2022-07-28 07:50:56 +02:00
Hyro 27a94d6f80 chore(action): fix 2022-07-27 08:20:47 +02:00
Hyro b0a04f5fb3 chore: bump version 2022-07-27 08:18:45 +02:00
Hyro ddba6331f8 chore: bump version 2022-07-27 08:18:27 +02:00
Hyro 99221c1ae0 fix(action): add github.token as default 2022-07-27 08:18:12 +02:00
Hyro 13923243f4 chore(README): add github token 2022-07-26 07:29:31 +02:00
xHyroM a9318b00d5 chore(test): update 2022-07-25 22:48:11 +02:00
xHyroM bf40fde936 chore(test): update 2022-07-25 22:36:22 +02:00
xHyroM 92c5bc2cef chore(test): add canary 2022-07-25 22:32:15 +02:00
xHyroM 37397a08ec feat: canary support 2022-07-25 22:31:43 +02:00
xHyroM a0f9c413e5 chore(workflows): update test 2022-07-16 18:53:20 +02:00
xHyroM d744239ce1 chore(workflows): update test 2022-07-16 18:52:25 +02:00
xHyroM bfac95679f chore(workflows): update test 2022-07-16 18:50:53 +02:00
xHyroM 640630d09e chore: bump version 2022-07-16 18:48:17 +02:00
xHyroM 70b6cfe9d1 chore: build 2022-07-16 18:47:40 +02:00
Hyro 933334b350 fix(getGithubRelease): correct token pass 2022-07-16 18:46:00 +02:00
Hyro c52f1f18be chore: new example 2022-07-13 09:42:54 +02:00
Hyro 08cc23c06e chore: bump version 2022-07-13 09:42:16 +02:00
Hyro baf23f03bc chore: bump version 2022-07-13 09:42:02 +02:00
Hyro 3868f53a52 chore(CI): fix workflow 2022-07-13 07:50:55 +02:00
xHyroM 627e67fd7b chore(CI): update test 2022-07-13 07:04:23 +02:00
xHyroM 62d40e4bee chore(CI): update test 2022-07-12 22:08:16 +02:00
xHyroM e838800258 chore(CI): change job status 2022-07-12 19:58:24 +02:00
xHyroM 37657f4f9f fix: dont fail 2022-07-12 19:56:32 +02:00
xHyroM 633e7abe1e fix: dont error when invalid asset for miscTestBuilds 2022-07-12 19:53:24 +02:00
xHyroM 4e76ddea17 fix: warn if bad version 2022-07-12 18:53:38 +02:00
xHyroM 5a78c10e01 fix: verion.trim is not function 2022-07-12 18:46:22 +02:00
xHyroM 6dae544af4 fix: correct repo for misc test builds 2022-07-12 18:43:56 +02:00
xHyroM 054bb2f631 chore: build 2022-07-12 18:42:27 +02:00
xHyroM 9f7c2a5c23 feat: add support for test builds 2022-07-12 18:39:58 +02:00
xHyroM 81ecfb54f4 chore: update package.json, license 2022-07-12 11:03:29 +02:00
2401 changed files with 2813 additions and 1382669 deletions
+1
View File
@@ -0,0 +1 @@
dist/**/* linguist-generated=true
@@ -0,0 +1,86 @@
name: ⚖️ Compare Bun Version
description: Compare the installed Bun version against a version specification.
inputs:
bun-version:
description: The version spec to compare against (e.g., '1.1.0', 'canary', '>1.2.0', '1.x').
required: true
runs:
using: composite
steps:
- name: 🛠️ Get installed Bun version and revision
id: bun
shell: bash
run: |
echo "version=$(bun --version | tr -d '\r\n')" >> $GITHUB_OUTPUT
echo "revision=$(bun --revision 2>/dev/null || true)" >> $GITHUB_OUTPUT
- name: ⚖️ Compare versions
shell: bash
env:
REQUESTED_SPEC: ${{ inputs.bun-version }}
ACTUAL_VERSION: ${{ steps.bun.outputs.version }}
ACTUAL_REVISION: ${{ steps.bun.outputs.revision }}
run: |
set -euo pipefail
# Function to compare two semantic versions (e.g., version_compare 1.2.3 1.10.0)
# Returns: 0 if v1 == v2, 1 if v1 > v2, 2 if v1 < v2
version_compare() {
if [[ "$1" == "$2" ]]; then return 0; fi
local lowest=$(printf '%s\n' "$1" "$2" | sort -V | head -n1)
if [[ "$1" == "$lowest" ]]; then return 2; else return 1; fi
}
echo "Requested spec: ${REQUESTED_SPEC}"
echo "Actual version: ${ACTUAL_VERSION}"
# Case 1: 'latest' - always passes
if [[ "${REQUESTED_SPEC}" == "latest" ]]; then
echo "OK: Skipping explicit version check for 'latest'."
exit 0
fi
# Case 2: 'canary' - check for 'canary' in revision or version string
if [[ "${REQUESTED_SPEC}" == "canary" ]]; then
if [[ "${ACTUAL_REVISION}" == *canary* ]] || [[ "${ACTUAL_VERSION}" == *canary* ]]; then
echo "OK: Detected canary build (version: ${ACTUAL_VERSION}, revision: ${ACTUAL_REVISION:-n/a})."
exit 0
else
echo "Error: Expected a canary build, but got ${ACTUAL_VERSION} (revision: ${ACTUAL_REVISION:-n/a})."
exit 1
fi
fi
# Case 3: Semver ranges (e.g., >1.0.0, <2, 1.x, 1.1.0)
op_part=$(echo "${REQUESTED_SPEC}" | sed -E 's/^([><=]*).*/\1/')
version_part=$(echo "${REQUESTED_SPEC}" | sed -E 's/^[><= ]*//')
op="${op_part:-==}"
version_base="${version_part//.x/}"
# Handle wildcards like '1.x' or '1'
if [[ "${version_part}" == *.x* ]] || { [[ ! "${version_part}" == *.* ]] && [[ "${op}" == "==" ]]; }; then
if [[ "${ACTUAL_VERSION}" == "${version_base}" || "${ACTUAL_VERSION}" == "${version_base}".* ]]; then
echo "OK: Version ${ACTUAL_VERSION} matches wildcard spec '${REQUESTED_SPEC}'."
exit 0
else
echo "Error: Version ${ACTUAL_VERSION} does not match wildcard spec '${REQUESTED_SPEC}'."
exit 1
fi
fi
# Perform comparison for >, <, >=, <=, ==
version_compare "${ACTUAL_VERSION}" "${version_part}" && result=0 || result=$?
case "${op}" in
'==') if [[ ${result} -ne 0 ]]; then echo "Error: Expected version ${version_part}, but got ${ACTUAL_VERSION}." && exit 1; fi ;;
'>') if [[ ${result} -ne 1 ]]; then echo "Error: Expected version > ${version_part}, but got ${ACTUAL_VERSION}." && exit 1; fi ;;
'<') if [[ ${result} -ne 2 ]]; then echo "Error: Expected version < ${version_part}, but got ${ACTUAL_VERSION}." && exit 1; fi ;;
'>=') if [[ ${result} -eq 2 ]]; then echo "Error: Expected version >= ${version_part}, but got ${ACTUAL_VERSION}." && exit 1; fi ;;
'<=') if [[ ${result} -eq 1 ]]; then echo "Error: Expected version <= ${version_part}, but got ${ACTUAL_VERSION}." && exit 1; fi ;;
*) echo "Error: Unsupported operator '${op}' in spec '${REQUESTED_SPEC}'." && exit 1 ;;
esac
echo "OK: Version ${ACTUAL_VERSION} satisfies spec '${REQUESTED_SPEC}'."
+32
View File
@@ -0,0 +1,32 @@
name: autofix.ci # Must be named this for autofix.ci to work
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: read
jobs:
format:
runs-on: ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 🛠️ Setup Bun
uses: ./
- name: 📦 Install Dependencies
run: bun install
- name: 🧹 Format
run: |
bun run format
bun run build
- name: 💾 Commit
uses: autofix-ci/action@635ffb0c9798bd160680f18fd73371e355b85f27 # v1.3.2
+27
View File
@@ -0,0 +1,27 @@
name: 🚀 Release new action version
on:
release:
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:
description: Tag name that the major tag will point to
required: true
permissions:
contents: write
jobs:
update_tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: actions/publish-action@23f4c6f12633a2da8f44938b71fde9afec138fb4 # v0.4.0
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
with:
source-tag: ${{ env.TAG_NAME }}
+273 -18
View File
@@ -1,29 +1,284 @@
name: test
name: 🧪 Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
pull_request:
push:
branches:
- main
permissions:
contents: write
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
bun-version:
["latest", "0.1.3"]
remove-cache:
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v2
- name: 📥 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 🗑️ Remove cache
run: gh cache delete --all || true
env:
GH_TOKEN: ${{ github.token }}
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup Bun
uses: ./
with:
bun-version: ${{ matrix.bun-version }}
github-token: ${{ secrets.GITHUB_TOKEN }}
no-cache: true
- name: Try bun
run: bun --version
- name: Install dependencies
run: bun install
- name: Run tests
run: bun test --coverage
setup-bun:
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache, tests]
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
- windows-11-arm
bun-version:
- latest
- canary
- "1.1.0"
- "1.3.10"
- "1.x"
- "1"
- "> 1.0.0"
- "< 2"
# https://github.com/oven-sh/setup-bun/issues/37
# - "1.x"
# - "1"
# - "> 1.0.0"
# - "< 2"
# Disable <sha> support for now. This is because Github Artifacts
# expire after 90 days, and we don't have another source of truth yet.
# - "822a00c4d508b54f650933a73ca5f4a3af9a7983" # 1.0.0 commit
steps:
- name: 📥 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 🛠️ Setup Bun
uses: ./
id: setup_bun
with:
bun-version: ${{ matrix.bun-version }}
no-cache: true
- name: ▶️ Run Bun
id: run_bun
run: |
bun --version
- name: ⚖️ Verify Bun version
uses: ./.github/actions/compare-bun-version
with:
bun-version: ${{ matrix.bun-version }}
setup-bun-from-file:
name: setup-bun from (${{ matrix.os }}, ${{ matrix.file.name }})
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache, tests]
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
- windows-11-arm
file:
- name: package.json (packageManager [email protected])
file: package.json
run: |
echo "$(jq '. += {"packageManager": "[email protected]"}' package.json)" > package.json
- name: foo/package.json (packageManager [email protected])
file: foo/package.json
run: |
mkdir -p foo
echo "$(jq '. += {"packageManager": "[email protected]"}' package.json)" > foo/package.json
- name: package.json (packageManager yarn@[email protected])
file: package.json
run: |
echo "$(jq '. += {"packageManager": "yarn@[email protected]"}' package.json)" > package.json
- name: package.json (engines [email protected])
file: package.json
run: |
echo "$(jq '.engines = {"bun": "1.1.0"}' package.json)" > package.json
- name: .tool-versions (bun 1.1.0)
file: .tool-versions
run: echo "bun 1.1.0" > .tool-versions
- name: .tool-versions (bun1.1.0)
file: .tool-versions
run: echo "bun1.1.0" > .tool-versions
- name: .tool-versions (bun 1.1.0)
file: .tool-versions
run: echo "bun 1.1.0" > .tool-versions
- name: .bumrc (1.1.0)
file: .bumrc
run: echo "1.1.0" > .bumrc
- name: .bun-version (1.1.0)
file: .bun-version
run: echo "1.1.0" > .bun-version
steps:
- name: 📥 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 📄 Setup file
run: ${{ matrix.file.run }}
- name: 🛠️ Setup Bun
uses: ./
with:
bun-version-file: ${{ matrix.file.file }}
no-cache: true
- name: ⚖️ Compare versions
uses: ./.github/actions/compare-bun-version
with:
bun-version: "1.1.0"
setup-bun-from-package-json-without-specified-field:
name: setup-bun from (${{ matrix.os }}, ${{ matrix.file.name }}) without specified field
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache, tests]
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
- windows-11-arm
file:
- name: package.json (packageManager [email protected])
file: package.json
run: |
echo "$(jq '. += {"packageManager": "[email protected]"}' package.json)" > package.json
- name: package.json (packageManager yarn@[email protected])
file: package.json
run: |
echo "$(jq '. += {"packageManager": "yarn@[email protected]"}' package.json)" > package.json
- name: package.json (engines [email protected])
file: package.json
run: |
echo "$(jq '.engines = {"bun": "1.1.0"}' package.json)" > package.json
steps:
- name: 📥 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 📄 Setup file
run: ${{ matrix.file.run }}
- name: 🛠️ Setup Bun
uses: ./
with:
no-cache: true
- name: ⚖️ Compare versions
uses: ./.github/actions/compare-bun-version
with:
bun-version: "1.1.0"
setup-bun-download-url:
name: setup-bun from (${{ matrix.os }}, download url)
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache, tests]
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 🛠️ Setup Bun
uses: ./
id: setup_bun
with:
bun-download-url: "https://github.com/oven-sh/bun/releases/latest/download/bun-${{runner.os == 'macOS' && 'darwin' || runner.os}}-${{ runner.arch == 'X64' && 'x64' || 'aarch64' }}.zip"
- name: ▶️ Run Bun
id: run_bun
run: |
bun --version
test-custom-registries:
name: test installing deps from custom registries (${{ matrix.os }})
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache, tests]
strategy:
matrix:
os:
- ubuntu-latest
steps:
- name: 📥 Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: 🛠️ Setup Bun
uses: ./
id: setup_bun
with:
registries: |
https://registry.npmjs.org
@types:https://registry.yarnpkg.com
- name: ▶️ Install from default registry
run: |
output=$(bun add is-odd --verbose --force 2>&1)
if echo "$output" | grep -q "HTTP/1.1 GET https://registry.npmjs.org/is-odd"; then
echo "Successfully installed from default registry"
else
echo "Failed to install from default registry"
exit 1
fi
- name: ▶️ Install from @types registry
run: |
output=$(bun add @types/bun --verbose --force 2>&1)
if echo "$output" | grep -q "HTTP/1.1 GET https://registry.yarnpkg.com/@types%2fbun"; then
echo "Successfully installed from @types registry"
else
echo "Failed to install from @types registry"
exit 1
fi
+3
View File
@@ -0,0 +1,3 @@
.DS_Store
node_modules/
+4
View File
@@ -0,0 +1,4 @@
{
"semi": true,
"quoteProps": "preserve"
}
+3
View File
@@ -0,0 +1,3 @@
{
"recommendations": ["esbenp.prettier-vscode", "github.vscode-github-actions"]
}
+12
View File
@@ -0,0 +1,12 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"search.exclude": {
"dist/**": true
},
// Lock changes to these files
"files.readonlyInclude": {
"dist/**": true,
"bun.lock": true,
"package-lock.json": true
},
}
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017 Toru Nagashima
Copyright (c) 2022 Jozef Steinhübl
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+84 -7
View File
@@ -1,22 +1,99 @@
# setup-bun
> Huge inspiration [setup-deno](https://github.com/denoland/setup-deno)
Set up your GitHub Actions workflow with a specific version of Bun.
Download, install, and setup [Bun](https://bun.sh) in GitHub Actions.
## Usage
### Latest stable
```yaml
- uses: oven-sh/setup-bun@v2
```
By default, if no version is specified, the action will:
1. Check `package.json` for the `packageManager` field (e.g., `"packageManager": "[email protected]"`)
2. If `packageManager` doesn't exist, check `package.json` for `engines.bun`
3. If neither exists or `package.json` is not found, use `latest`
You can also explicitly specify a version:
```yaml
- uses: xhyrom/setup-bun@v0.1.2
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
```
### Specific version
## Using version file
```yaml
- uses: xhyrom/setup-bun@v0.1.2
- uses: oven-sh/setup-bun@v2
with:
bun-version: "0.1.3"
bun-version-file: ".bun-version"
```
## Using custom registries
You can configure multiple package registries using the `registries` input. This supports both default and scoped registries with various authentication methods.
### Registry configuration
```yaml
- uses: oven-sh/setup-bun@v2
with:
registries: |
https://registry.npmjs.org/
@myorg:https://npm.pkg.github.com/|$GITHUB_TOKEN
@internal:https://username:[email protected]/
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INTERNAL_PASSWORD: ${{ secrets.INTERNAL_PASSWORD }}
run: bun install
```
#### Registry format options
| Type | Format |
| ------------------------------------ | --------------------------------------------------------- |
| Default registry | `https://registry.example.com/` |
| Default registry with token | `https://registry.example.com/\|$TOKEN` |
| Scoped registry | `@scope:https://registry.example.com/` |
| Scoped registry with token | `@scope:https://registry.example.com/\|$TOKEN` |
| Scoped registry with URL credentials | `@scope:https://username:[email protected]/` |
> [!IMPORTANT]
> When using authentication, make sure to set the corresponding environment variables in your workflow steps that need access to the registries.
For more information about configuring registries in Bun, see the [official documentation](https://bun.sh/docs/install/registries).
### Override download url
If you need to override the download URL, you can use the `bun-download-url` input.
```yaml
- uses: oven-sh/setup-bun@v2
with:
bun-download-url: "https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip"
```
## Inputs
| Name | Description | Default | Examples |
| ------------------ | --------------------------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------------ |
| `bun-version` | The version of Bun to download and install. | Version from `package.json`, or `latest` | `canary`, `1.0.0`, `1.0.x` |
| `bun-version-file` | The version of Bun to download and install from file. | `undefined` | `package.json`, `.bun-version`, `.tool-versions` |
| `bun-download-url` | URL to download .zip file for Bun release | | |
| `registry-url` | Registry URL where some private package is stored. | `undefined` | `"https://npm.pkg.github.com/"` |
| `scope` | Scope for private packages. | `undefined` | `"@foo"`, `"@orgname"` |
| `no-cache` | Disable caching of the downloaded executable. | `false` | `true`, `false` |
| `token` | Personal access token (PAT) used to fetch tags from the `oven-sh/bun` repository. | `${{ github.token }}` | `${{ secrets.GITHUB_TOKEN }}` |
## Outputs
| Name | Description | Example |
| ------------------ | ------------------------------------------ | ------------------------------------------------------------------ |
| `bun-version` | The output from `bun --version`. | `1.0.0` |
| `bun-revision` | The output from `bun --revision`. | `1.0.0+822a00c4` |
| `bun-path` | The path to the Bun executable. | `/path/to/bun` |
| `bun-download-url` | The URL from which Bun was downloaded. | `https://bun.sh/download/latest/linux/x64?avx2=true&profile=false` |
| `cache-hit` | If the Bun executable was read from cache. | `true` |
+53 -12
View File
@@ -1,22 +1,63 @@
name: "Setup Bun"
description: "Setup Bun by installing, downloading, and adding it to the path"
author: "xHyroM"
name: Setup Bun
description: Download, install, and setup Bun to your path.
author: robobun
branding:
icon: "play-circle"
color: "white"
icon: play-circle
color: white
inputs:
bun-version:
description: "The Bun version to install."
default: "latest"
github-token:
description: "The github token secret can be passed in using {{ secrets.GITHUB_TOKEN }}"
description: The version of Bun to install. (e.g. "latest", "canary", "1.0.0", "1.0.x", <sha>)
required: false
bun-version-file:
description: The version of Bun to install from file. (e.g. "package.json", ".bun-version", ".tool-versions")
default: null
required: false
bun-download-url:
description: Override the URL to download Bun from. This skips version resolution and verifying AVX2 support.
required: false
registries:
description: |
List of package registries with authentication support. Format:
- Default registry: https://registry.npmjs.org/
- Default with token: https://registry.npmjs.org/|token
- Scoped registry: @scope:https://registry.example.com/
- Scoped with token: @scope:https://registry.example.com/|token
- Scoped with credentials: @scope:https://user:[email protected]/
required: false
registry-url:
required: false
description: The URL of the package registry to use for installing Bun. Set the $BUN_AUTH_TOKEN environment variable to authenticate with the registry.
deprecationMessage: "Use 'registries' input instead."
scope:
required: false
description: "The scope for authenticating with the package registry."
deprecationMessage: "Use 'registries' input instead."
no-cache:
required: false
type: boolean
default: false
description: Disable caching of bun executable.
token:
required: false
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
description: Personal access token (PAT) used to fetch tags from oven-sh/bun repository. Recommended for resolving wildcard/range versions to avoid GitHub API rate limiting. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
outputs:
bun-version:
description: "The Bun version that was installed."
description: The version of Bun that was installed.
bun-revision:
description: The revision of Bun that was installed.
bun-path:
description: The path to the Bun executable.
bun-download-url:
description: The URL from which Bun was downloaded.
cache-hit:
description: If the version of Bun was cached.
runs:
using: "node12"
main: "dist/index.js"
using: "node24"
main: "dist/setup/index.js"
post: "dist/cache-save/index.js"
post-if: success()
+225
View File
File diff suppressed because one or more lines are too long
BIN
View File
Binary file not shown.
+2
View File
@@ -0,0 +1,2 @@
[install]
saveTextLockfile = true
Generated Vendored
+123
View File
File diff suppressed because one or more lines are too long
Generated Vendored
-25
View File
@@ -1,25 +0,0 @@
import { getInput, info, setFailed, setOutput } from '@actions/core';
import getGithubRelease from './utils/getGithubRelease.js';
import install from './utils/install.js';
const exit = (error) => {
setFailed(error);
process.exit();
};
const main = async () => {
try {
const version = getInput('bun-version');
const token = getInput('github-token');
if (!version)
return exit('Invalid bun version.');
const release = await getGithubRelease(version, token);
if ((release === null || release === void 0 ? void 0 : release.message) === 'Not Found')
return exit('Invalid bun version.');
info(`Going to install release ${release.version}`);
await install(release);
setOutput('bun-version', release.tag_name);
}
catch (e) {
exit(e);
}
};
main();
Generated Vendored
+143
View File
File diff suppressed because one or more lines are too long
Generated Vendored
-19
View File
@@ -1,19 +0,0 @@
export default (assets) => {
let arch;
switch (process.arch) {
case 'arm64':
arch = 'aarch64';
break;
case 'x64':
arch = 'x64';
break;
default:
throw new Error(`Unsupported architechture ${process.arch}.`);
}
if (!['linux', 'darwin'].some(platform => process.platform === platform))
throw new Error(`Unsupported platform ${process.platform}.`);
return {
name: `bun-${process.platform}-${arch}`,
asset: assets.find(asset => asset.name === `bun-${process.platform}-${arch}.zip`),
};
};
-19
View File
@@ -1,19 +0,0 @@
import fetch from 'node-fetch';
export default async (version, token) => {
let url;
if (version === 'latest')
url = 'https://api.github.com/repos/oven-sh/bun/releases/latest';
else
url = `https://api.github.com/repos/oven-sh/bun/releases/tags/bun-v${version}`;
const release = await (await fetch(url, {
headers: {
'Content-Type': 'application/json',
'User-Agent': 'setup-bun-github-action',
'Authorization': token
}
})).json();
return {
...release,
version: release.tag_name.replace('bun-v', '')
};
};
Generated Vendored
-3
View File
@@ -1,3 +0,0 @@
export default () => {
return process.env[process.platform == 'win32' ? 'USERPROFILE' : 'HOME'];
};
Generated Vendored
-27
View File
@@ -1,27 +0,0 @@
import { cacheDir, downloadTool, extractZip, find } from '@actions/tool-cache';
import { restoreCache, saveCache } from '@actions/cache';
import { addPath, info } from '@actions/core';
import getAsset from './getAsset.js';
import { join } from 'path';
import { homedir } from 'os';
export default async (release) => {
const asset = getAsset(release.assets);
const path = join(homedir(), '.bun', 'bin', asset.name);
const cache = find('bun', release.version) || await restoreCache([path], `bun-${process.platform}-${asset.name}-${release.version}`);
if (cache) {
info(`Using cached Bun installation from ${cache}.`);
addPath(path);
return;
}
info(`Downloading Bun from ${asset.asset.browser_download_url}.`);
const zipPath = await downloadTool(asset.asset.browser_download_url);
const extracted = await extractZip(zipPath, join(homedir(), '.bun', 'bin'));
const newCache = await cacheDir(extracted, 'bun', release.version);
await saveCache([
join(extracted, asset.name)
], `bun-${process.platform}-${asset.name}-${release.version}`);
info(`Cached Bun to ${newCache}.`);
addPath(newCache);
const bunPath = join(homedir(), '.bun', 'bin', asset.name);
addPath(bunPath);
};
Generated Vendored
-1
View File
@@ -1 +0,0 @@
../semver/bin/semver.js
Generated Vendored
-1
View File
@@ -1 +0,0 @@
../typescript/bin/tsc
Generated Vendored
-1
View File
@@ -1 +0,0 @@
../typescript/bin/tsserver
Generated Vendored
-1
View File
@@ -1 +0,0 @@
../uuid/bin/uuid
-9
View File
@@ -1,9 +0,0 @@
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-44
View File
@@ -1,44 +0,0 @@
# `@actions/cache`
> Functions necessary for caching dependencies and build outputs to improve workflow execution time.
See ["Caching dependencies to speed up workflows"](https://help.github.com/github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows) for how caching works.
Note that GitHub will remove any cache entries that have not been accessed in over 7 days. There is no limit on the number of caches you can store, but the total size of all caches in a repository is limited to 10 GB. If you exceed this limit, GitHub will save your cache but will begin evicting caches until the total size is less than 10 GB.
## Usage
This package is used by the v2+ versions of our first party cache action. You can find an example implementation in the cache repo [here](https://github.com/actions/cache).
#### Save Cache
Saves a cache containing the files in `paths` using the `key` provided. The files would be compressed using zstandard compression algorithm if zstd is installed, otherwise gzip is used. Function returns the cache id if the cache was saved succesfully and throws an error if cache upload fails.
```js
const cache = require('@actions/cache');
const paths = [
'node_modules',
'packages/*/node_modules/'
]
const key = 'npm-foobar-d5ea0750'
const cacheId = await cache.saveCache(paths, key)
```
#### Restore Cache
Restores a cache based on `key` and `restoreKeys` to the `paths` provided. Function returns the cache key for cache hit and returns undefined if cache not found.
```js
const cache = require('@actions/cache');
const paths = [
'node_modules',
'packages/*/node_modules/'
]
const key = 'npm-foobar-d5ea0750'
const restoreKeys = [
'npm-foobar-',
'npm-'
]
const cacheKey = await cache.restoreCache(paths, key, restoreKeys)
```
-32
View File
@@ -1,32 +0,0 @@
import { DownloadOptions, UploadOptions } from './options';
export declare class ValidationError extends Error {
constructor(message: string);
}
export declare class ReserveCacheError extends Error {
constructor(message: string);
}
/**
* isFeatureAvailable to check the presence of Actions cache service
*
* @returns boolean return true if Actions cache service feature is available, otherwise false
*/
export declare function isFeatureAvailable(): boolean;
/**
* Restores cache from keys
*
* @param paths a list of file paths to restore from the cache
* @param primaryKey an explicit key for restoring the cache
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
* @param downloadOptions cache download options
* @returns string returns the key for the cache hit, otherwise returns undefined
*/
export declare function restoreCache(paths: string[], primaryKey: string, restoreKeys?: string[], options?: DownloadOptions): Promise<string | undefined>;
/**
* Saves a list of files with the specified key
*
* @param paths a list of file paths to be cached
* @param key an explicit key for restoring the cache
* @param options cache upload options
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
*/
export declare function saveCache(paths: string[], key: string, options?: UploadOptions): Promise<number>;
-210
View File
@@ -1,210 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const path = __importStar(require("path"));
const utils = __importStar(require("./internal/cacheUtils"));
const cacheHttpClient = __importStar(require("./internal/cacheHttpClient"));
const tar_1 = require("./internal/tar");
class ValidationError extends Error {
constructor(message) {
super(message);
this.name = 'ValidationError';
Object.setPrototypeOf(this, ValidationError.prototype);
}
}
exports.ValidationError = ValidationError;
class ReserveCacheError extends Error {
constructor(message) {
super(message);
this.name = 'ReserveCacheError';
Object.setPrototypeOf(this, ReserveCacheError.prototype);
}
}
exports.ReserveCacheError = ReserveCacheError;
function checkPaths(paths) {
if (!paths || paths.length === 0) {
throw new ValidationError(`Path Validation Error: At least one directory or file path is required`);
}
}
function checkKey(key) {
if (key.length > 512) {
throw new ValidationError(`Key Validation Error: ${key} cannot be larger than 512 characters.`);
}
const regex = /^[^,]*$/;
if (!regex.test(key)) {
throw new ValidationError(`Key Validation Error: ${key} cannot contain commas.`);
}
}
/**
* isFeatureAvailable to check the presence of Actions cache service
*
* @returns boolean return true if Actions cache service feature is available, otherwise false
*/
function isFeatureAvailable() {
return !!process.env['ACTIONS_CACHE_URL'];
}
exports.isFeatureAvailable = isFeatureAvailable;
/**
* Restores cache from keys
*
* @param paths a list of file paths to restore from the cache
* @param primaryKey an explicit key for restoring the cache
* @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for key
* @param downloadOptions cache download options
* @returns string returns the key for the cache hit, otherwise returns undefined
*/
function restoreCache(paths, primaryKey, restoreKeys, options) {
return __awaiter(this, void 0, void 0, function* () {
checkPaths(paths);
restoreKeys = restoreKeys || [];
const keys = [primaryKey, ...restoreKeys];
core.debug('Resolved Keys:');
core.debug(JSON.stringify(keys));
if (keys.length > 10) {
throw new ValidationError(`Key Validation Error: Keys are limited to a maximum of 10.`);
}
for (const key of keys) {
checkKey(key);
}
const compressionMethod = yield utils.getCompressionMethod();
let archivePath = '';
try {
// path are needed to compute version
const cacheEntry = yield cacheHttpClient.getCacheEntry(keys, paths, {
compressionMethod
});
if (!(cacheEntry === null || cacheEntry === void 0 ? void 0 : cacheEntry.archiveLocation)) {
// Cache not found
return undefined;
}
archivePath = path.join(yield utils.createTempDirectory(), utils.getCacheFileName(compressionMethod));
core.debug(`Archive Path: ${archivePath}`);
// Download the cache from the cache entry
yield cacheHttpClient.downloadCache(cacheEntry.archiveLocation, archivePath, options);
if (core.isDebug()) {
yield tar_1.listTar(archivePath, compressionMethod);
}
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core.info(`Cache Size: ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B)`);
yield tar_1.extractTar(archivePath, compressionMethod);
core.info('Cache restored successfully');
return cacheEntry.cacheKey;
}
catch (error) {
const typedError = error;
if (typedError.name === ValidationError.name) {
throw error;
}
else {
// Supress all non-validation cache related errors because caching should be optional
core.warning(`Failed to restore: ${error.message}`);
}
}
finally {
// Try to delete the archive to save space
try {
yield utils.unlinkFile(archivePath);
}
catch (error) {
core.debug(`Failed to delete archive: ${error}`);
}
}
return undefined;
});
}
exports.restoreCache = restoreCache;
/**
* Saves a list of files with the specified key
*
* @param paths a list of file paths to be cached
* @param key an explicit key for restoring the cache
* @param options cache upload options
* @returns number returns cacheId if the cache was saved successfully and throws an error if save fails
*/
function saveCache(paths, key, options) {
var _a, _b, _c, _d, _e;
return __awaiter(this, void 0, void 0, function* () {
checkPaths(paths);
checkKey(key);
const compressionMethod = yield utils.getCompressionMethod();
let cacheId = -1;
const cachePaths = yield utils.resolvePaths(paths);
core.debug('Cache Paths:');
core.debug(`${JSON.stringify(cachePaths)}`);
if (cachePaths.length === 0) {
throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);
}
const archiveFolder = yield utils.createTempDirectory();
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
core.debug(`Archive Path: ${archivePath}`);
try {
yield tar_1.createTar(archiveFolder, cachePaths, compressionMethod);
if (core.isDebug()) {
yield tar_1.listTar(archivePath, compressionMethod);
}
const fileSizeLimit = 10 * 1024 * 1024 * 1024; // 10GB per repo limit
const archiveFileSize = utils.getArchiveFileSizeInBytes(archivePath);
core.debug(`File Size: ${archiveFileSize}`);
// For GHES, this check will take place in ReserveCache API with enterprise file size limit
if (archiveFileSize > fileSizeLimit && !utils.isGhes()) {
throw new Error(`Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the 10GB limit, not saving cache.`);
}
core.debug('Reserving Cache');
const reserveCacheResponse = yield cacheHttpClient.reserveCache(key, paths, {
compressionMethod,
cacheSize: archiveFileSize
});
if ((_a = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _a === void 0 ? void 0 : _a.cacheId) {
cacheId = (_b = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.result) === null || _b === void 0 ? void 0 : _b.cacheId;
}
else if ((reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.statusCode) === 400) {
throw new Error((_d = (_c = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : `Cache size of ~${Math.round(archiveFileSize / (1024 * 1024))} MB (${archiveFileSize} B) is over the data cap limit, not saving cache.`);
}
else {
throw new ReserveCacheError(`Unable to reserve cache with key ${key}, another job may be creating this cache. More details: ${(_e = reserveCacheResponse === null || reserveCacheResponse === void 0 ? void 0 : reserveCacheResponse.error) === null || _e === void 0 ? void 0 : _e.message}`);
}
core.debug(`Saving Cache (ID: ${cacheId})`);
yield cacheHttpClient.saveCache(cacheId, archivePath, options);
}
catch (error) {
const typedError = error;
if (typedError.name === ValidationError.name) {
throw error;
}
else if (typedError.name === ReserveCacheError.name) {
core.info(`Failed to save: ${typedError.message}`);
}
else {
core.warning(`Failed to save: ${typedError.message}`);
}
}
finally {
// Try to delete the archive to save space
try {
yield utils.unlinkFile(archivePath);
}
catch (error) {
core.debug(`Failed to delete archive: ${error}`);
}
}
return cacheId;
});
}
exports.saveCache = saveCache;
//# sourceMappingURL=cache.js.map

Some files were not shown because too many files have changed in this diff Show More