Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c623269
feat: support for multiple registries
xhyrom Nov 16, 2024
4c86bb4
[autofix.ci] apply automated fixes
autofix-ci[bot] Nov 16, 2024
5f6f054
refactor: drop unnecessary check
xhyrom Nov 16, 2024
dd6ac17
fix: pass empty array instead undefined
xhyrom Nov 16, 2024
0045b01
[autofix.ci] apply automated fixes
autofix-ci[bot] Nov 16, 2024
baad454
fix: dont add registry set line
xhyrom Nov 16, 2024
87bdff4
[autofix.ci] apply automated fixes
autofix-ci[bot] Nov 16, 2024
f84b1d1
feat: few more tests
xhyrom Nov 16, 2024
3480f83
feat: add bun types
xhyrom Nov 16, 2024
6cb53bc
docs: explain registries
xhyrom Nov 16, 2024
2eed696
feat: save globally
xhyrom Dec 8, 2024
95fe79d
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 8, 2024
e8a5565
ci: jsr registry test
xhyrom Dec 8, 2024
e31304e
ci: add ,
xhyrom Dec 8, 2024
7903ff9
ci: test
xhyrom Dec 12, 2024
1a5885b
ci: test
xhyrom Dec 12, 2024
822557a
ci: test
xhyrom Dec 12, 2024
3893b07
ci: test
xhyrom Dec 12, 2024
2db092b
[autofix.ci] apply automated fixes
autofix-ci[bot] Dec 12, 2024
7a1e37e
feat: use @iarna/toml
xhyrom Jul 8, 2025
9bb0f8c
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 8, 2025
93e48f7
feat: registry parsing
xhyrom Jul 8, 2025
b92eb59
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 8, 2025
9331ec6
ci: verbose add
xhyrom Jul 8, 2025
c384e3a
ci: registry install check
xhyrom Jul 8, 2025
b45ff82
ci: registry install check
xhyrom Jul 8, 2025
bd97ab1
ci: registry install check
xhyrom Jul 8, 2025
2b1c606
ci: verify registry usage
xhyrom Jul 8, 2025
b9c0f54
docs: registries
xhyrom Jul 8, 2025
6aaca7b
docs: important block
xhyrom Jul 8, 2025
b8be0fe
docs: show table
xhyrom Jul 8, 2025
90cf21e
docs: show table
xhyrom Jul 8, 2025
fd8520f
ci: shell
xhyrom Jul 8, 2025
dd17778
ci: registry test on linux
xhyrom Jul 8, 2025
31f83eb
ci: registry test on linux
xhyrom Jul 8, 2025
f320ab3
build: text lockfile
xhyrom Jul 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 63 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,26 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}

tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Bun
uses: ./

- 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]
needs: [remove-cache, tests]

strategy:
matrix:
Expand Down Expand Up @@ -65,7 +81,7 @@ jobs:
name: setup-bun from (${{ matrix.os }}, ${{ matrix.file.name }})
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache]
needs: [remove-cache, tests]
strategy:
matrix:
os:
Expand Down Expand Up @@ -130,7 +146,7 @@ jobs:
name: setup-bun from (${{ matrix.os }}, download url)
runs-on: ${{ matrix.os }}
continue-on-error: true
needs: [remove-cache]
needs: [remove-cache, tests]

strategy:
matrix:
Expand All @@ -153,3 +169,47 @@ jobs:
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@v4

- 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
38 changes: 28 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,42 @@ Download, install, and setup [Bun](https://bun.sh) in GitHub Actions.
bun-version-file: ".bun-version"
```

### Using a custom NPM registry
## 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:
registry-url: "https://npm.pkg.github.com/"
scope: "@foo"
```
registries: |
https://registry.npmjs.org/
@myorg:https://npm.pkg.github.com/|$GITHUB_TOKEN
@internal:https://username:$INTERNAL_PASSWORD@registry.internal.com/

If you need to authenticate with a private registry, you can set the `BUN_AUTH_TOKEN` environment variable.

```yaml
- name: Install Dependencies
- name: Install dependencies
env:
BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: bun install --frozen-lockfile
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:$PASSWORD@registry.example.com/` |

> [!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.
Expand Down
13 changes: 12 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,23 @@ inputs:
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:pass@registry.example.com/
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.
description: "The scope for authenticating with the package registry."
deprecationMessage: "Use 'registries' input instead."
no-cache:
required: false
type: boolean
Expand Down
Loading
Loading