@d-dev/bin-upload-darwin-x64 0.0.12 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -309
- package/bin/bin-upload +0 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
# Bin Upload
|
|
2
2
|
|
|
3
|
-
Easily distribute binaries via npm, pypi, and GitHub releases.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
3
|
+
> Easily distribute binaries via npm, pypi, and GitHub releases.
|
|
6
4
|
|
|
7
5
|
`bin-upload` is a CLI tool built with [Bun](https://bun.sh) that packages and publishes pre-built binaries to multiple registries and platforms. It supports:
|
|
8
6
|
|
|
9
|
-
- **npm** — Publishes a main package that
|
|
7
|
+
- **npm** — Publishes a main package that depends on platform-specific binary packages using [optionalDependencies](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#optionaldependencies).
|
|
10
8
|
- **PyPI** — Builds wheel (`.whl`) packages for each platform-specific tag.
|
|
11
9
|
- **GitHub Releases** — Creates releases and uploads archive assets (`.tar.gz` or `.zip`).
|
|
12
10
|
|
|
11
|
+
[Full documentation](https://dworthen.github.io/bin-upload/).
|
|
12
|
+
|
|
13
13
|
## Installation
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
<!-- tabs:start -->
|
|
16
|
+
|
|
17
|
+
### **NPM**
|
|
16
18
|
|
|
17
19
|
```sh
|
|
18
20
|
# Globally
|
|
@@ -23,7 +25,7 @@ npm install -D @d-dev/bin-upload
|
|
|
23
25
|
npx @d-dev/bin-upload <command>
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
###
|
|
28
|
+
### **Python**
|
|
27
29
|
|
|
28
30
|
```sh
|
|
29
31
|
pip install bin-upload
|
|
@@ -33,354 +35,91 @@ uv tool install bin-upload
|
|
|
33
35
|
uvx bin-upload <command>
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
###
|
|
38
|
+
### **GitHub Releases**
|
|
37
39
|
|
|
38
40
|
Download the appropriate binary for your platform from the [releases page](https://github.com/dworthen/bin-upload/releases).
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
<!-- tabs:end -->
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
## Requirements
|
|
43
45
|
|
|
44
46
|
The following must be installed and available on your path.
|
|
45
47
|
|
|
46
48
|
- [npm](https://www.npmjs.com/): if publishing to npm
|
|
47
49
|
- [uv](https://docs.astral.sh/uv/): if publishing to pypi
|
|
48
50
|
|
|
49
|
-
1.
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
bin-upload init
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
This will walk you through an interactive prompt and generate a `bin-upload.config.yaml` file.
|
|
56
|
-
|
|
57
|
-
2. **Pack binaries into publishable artifacts:**
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
bin-upload pack
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
This will generate artifacts that can be published to npm (tarballs), pypi (wheel), and GitHub (tarballs and zips).
|
|
64
|
-
|
|
65
|
-
3. **Publish the artifacts:**
|
|
66
|
-
|
|
67
|
-
```sh
|
|
68
|
-
bin-upload publish
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
This publishes the artifacts generatd by the `pack` command.
|
|
72
|
-
|
|
73
|
-
## Commands
|
|
74
|
-
|
|
75
|
-
### `init`
|
|
76
|
-
|
|
77
|
-
Initialize a `bin-upload` configuration file via interactive prompts.
|
|
51
|
+
## 1. Init
|
|
78
52
|
|
|
79
53
|
```sh
|
|
80
|
-
bin-upload init
|
|
54
|
+
bin-upload init
|
|
81
55
|
```
|
|
82
56
|
|
|
83
|
-
|
|
84
|
-
| -------------- | -------------------------------------- |
|
|
85
|
-
| `--help, -h` | Show help. |
|
|
86
|
-
| `--config, -c` | Path to output configuration file. |
|
|
87
|
-
| `--force, -f` | Overwrite existing configuration file. |
|
|
88
|
-
|
|
89
|
-
### `pack`
|
|
90
|
-
|
|
91
|
-
Build publishable artifacts (npm tarballs, PyPI wheels, GitHub archives) from your binaries.
|
|
92
|
-
|
|
93
|
-
```sh
|
|
94
|
-
bin-upload pack [options]
|
|
95
|
-
```
|
|
57
|
+
This will walk you through an interactive prompt and generate a `bin-upload.config.yaml` file.
|
|
96
58
|
|
|
97
|
-
|
|
98
|
-
| -------------- | ---------------------------------------------------------------------- |
|
|
99
|
-
| `--help, -h` | Show help. |
|
|
100
|
-
| `--config, -c` | Path to YAML configuration file. Default: `bin-upload.config.yaml`. |
|
|
101
|
-
| `--set, -s` | Set configuration values, e.g., `--set npm.packageJson.version=1.0.0`. |
|
|
102
|
-
| `--source` | Sources to pack: `all`, `npm`, `pypi`, `github`. Default: `all`. |
|
|
103
|
-
| `--verbose` | Enable verbose logging. |
|
|
59
|
+
More on configuration [here](/configuration).
|
|
104
60
|
|
|
105
|
-
|
|
61
|
+
## 2. Pack
|
|
106
62
|
|
|
107
|
-
|
|
63
|
+
### Git flow
|
|
108
64
|
|
|
109
|
-
```sh
|
|
110
|
-
bin-upload publish [options]
|
|
111
65
|
```
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
| `--config, -c` | Path to YAML configuration file. Default: `bin-upload.config.yaml`. |
|
|
117
|
-
| `--set, -s` | Set configuration values, e.g., `--set pypi.publish.token=some-token`. |
|
|
118
|
-
| `--source` | Sources to publish: `all`, `npm`, `pypi`, `github`. Default: `all`. |
|
|
119
|
-
| `--verbose` | Enable verbose logging. |
|
|
120
|
-
|
|
121
|
-
## Configuration
|
|
122
|
-
|
|
123
|
-
The configuration file is a YAML file (default: `bin-upload.config.yaml`) that supports [Eta](https://eta.js.org/docs/4.x.x/intro/quickstart) templating with access to environment variables and built-in variables.
|
|
124
|
-
|
|
125
|
-
### Template Variables
|
|
126
|
-
|
|
127
|
-
- `env` — Access environment variables, e.g., `<%= env.NPM_TOKEN %>`.
|
|
128
|
-
- `vars.gitTag` — The latest semver git tag (without the `v` prefix), extracted from tags matching `v*.*.*`.
|
|
129
|
-
|
|
130
|
-
### Configuration Structure
|
|
131
|
-
|
|
132
|
-
```yaml
|
|
133
|
-
binaries:
|
|
134
|
-
# binaryId -> path to binary file
|
|
135
|
-
linux-x64: "./bin/linux-x64/my-binary"
|
|
136
|
-
darwin-arm64: "./bin/darwin-arm64/my-binary"
|
|
137
|
-
win-x64: "./bin/win-x64/my-binary.exe"
|
|
138
|
-
|
|
139
|
-
pack:
|
|
140
|
-
prePackCommand: "bun run build" # Optional command to run before packing
|
|
141
|
-
dir: "./dist" # Output directory for packed artifacts
|
|
142
|
-
|
|
143
|
-
npm:
|
|
144
|
-
readmeFile: "README.md"
|
|
145
|
-
licenseFile: "LICENSE"
|
|
146
|
-
packageJson:
|
|
147
|
-
name: "@scope/my-package"
|
|
148
|
-
version: <%= vars.gitTag %>
|
|
149
|
-
description: "My binary package"
|
|
150
|
-
license: "MIT"
|
|
151
|
-
binaryPackages:
|
|
152
|
-
# binaryId -> { name, os, arch } using Node.js process.platform/process.arch values
|
|
153
|
-
linux-x64:
|
|
154
|
-
name: "@scope/my-package-linux-x64"
|
|
155
|
-
os: "linux"
|
|
156
|
-
arch: "x64"
|
|
157
|
-
darwin-arm64:
|
|
158
|
-
name: "@scope/my-package-darwin-arm64"
|
|
159
|
-
os: "darwin"
|
|
160
|
-
arch: "arm64"
|
|
161
|
-
win-x64:
|
|
162
|
-
name: "@scope/my-package-win-x64"
|
|
163
|
-
os: "win32"
|
|
164
|
-
arch: "x64"
|
|
165
|
-
binNames:
|
|
166
|
-
- "my-binary" # Optional custom bin entry point names
|
|
167
|
-
publish:
|
|
168
|
-
access: "public"
|
|
169
|
-
tag: "latest"
|
|
170
|
-
# For publishing from local machine
|
|
171
|
-
# Should omit if publishing from GitHub actions
|
|
172
|
-
# using trusted publisher with npm
|
|
173
|
-
"registry=https://registry.npmjs.org/": true
|
|
174
|
-
"//registry.npmjs.org/:_authToken=<%= env.NPM_TOKEN %>": true
|
|
175
|
-
|
|
176
|
-
pypi:
|
|
177
|
-
readmeFile: "README.md"
|
|
178
|
-
platformTags:
|
|
179
|
-
# binaryId -> wheel platform tag
|
|
180
|
-
linux-x64: "manylinux_2_17_x86_64"
|
|
181
|
-
darwin-arm64: "macosx_11_0_arm64"
|
|
182
|
-
win-x64: "win_amd64"
|
|
183
|
-
metadata:
|
|
184
|
-
Name: "my-package"
|
|
185
|
-
Version: <%= vars.gitTag %>
|
|
186
|
-
Summary: "My binary package"
|
|
187
|
-
Requires-Python: ">=3.11"
|
|
188
|
-
entryPointNames:
|
|
189
|
-
- "my-binary" # Optional custom console_scripts entry points
|
|
190
|
-
publish:
|
|
191
|
-
# For publishing from local machine
|
|
192
|
-
# should omit if publishing from GitHub actions
|
|
193
|
-
# using trusted publisher with pypi
|
|
194
|
-
token: "<%= env.PYPI_TOKEN %>"
|
|
195
|
-
|
|
196
|
-
github:
|
|
197
|
-
owner: "my-org"
|
|
198
|
-
repo: "my-repo"
|
|
199
|
-
# Token should have the following repository level permissions
|
|
200
|
-
# Metadata read
|
|
201
|
-
# Contents read and write
|
|
202
|
-
token: "<%= env.GITHUB_TOKEN %>"
|
|
203
|
-
release:
|
|
204
|
-
tag_name: "v<%= vars.gitTag %>"
|
|
205
|
-
archives:
|
|
206
|
-
# Simple: binaryId -> format
|
|
207
|
-
linux-x64: "tar.gz"
|
|
208
|
-
win-x64: "zip"
|
|
209
|
-
# Advanced: custom archive with file globs
|
|
210
|
-
# source:
|
|
211
|
-
# format: "tar.gz"
|
|
212
|
-
# files:
|
|
213
|
-
# - cwd: "src"
|
|
214
|
-
# pattern: "**/*"
|
|
215
|
-
# - "README.md"
|
|
66
|
+
git add .
|
|
67
|
+
git commit -m "..."
|
|
68
|
+
git tag -a v1.0.0 -m "Release v1.0.0"
|
|
69
|
+
bin-upload pack
|
|
216
70
|
```
|
|
217
71
|
|
|
218
|
-
###
|
|
219
|
-
|
|
220
|
-
Use `--set` (`-s`) to override configuration values using dot notation:
|
|
72
|
+
### Non-git flow
|
|
221
73
|
|
|
222
74
|
```sh
|
|
223
75
|
bin-upload pack -s npm.packageJson.version=1.0.0 -s pypi.metadata.Version=1.0.0
|
|
224
|
-
bin-upload publish -s "pypi.publish.token=some-token"
|
|
225
76
|
```
|
|
226
77
|
|
|
227
|
-
This will
|
|
78
|
+
This will generate artifacts in `.bin-upload` that can be published to npm (tarballs), pypi (wheel), and GitHub (tarballs and zips).
|
|
228
79
|
|
|
229
|
-
|
|
230
|
-
npm
|
|
231
|
-
packageJson
|
|
232
|
-
version: 1.0.0
|
|
80
|
+
More on the pack command, including how to test artifacts prior to publishing, can be viewed [here](/pack).
|
|
233
81
|
|
|
234
|
-
|
|
235
|
-
metadata
|
|
236
|
-
Version: 1.0.0
|
|
237
|
-
```
|
|
82
|
+
## 3. Publish
|
|
238
83
|
|
|
239
|
-
|
|
84
|
+
Create a `.env` file with the following tokens.
|
|
240
85
|
|
|
241
|
-
```sh
|
|
242
|
-
bin-upload publish -s "npm.publish.registry\=https://registry\.npmjs\.org/=true"
|
|
243
86
|
```
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
87
|
+
# NPM granular access token that bypasses 2FA
|
|
88
|
+
# https://docs.npmjs.com/about-access-tokens
|
|
89
|
+
NPM_TOKEN="YOUR NPM TOKEN"
|
|
90
|
+
# GitHub token with repository metadata read and
|
|
91
|
+
# contents write permissions
|
|
92
|
+
GITHUB_TOKEN="YOUR GITHUB TOKEN"
|
|
93
|
+
PYPI_TOKEN="YOUR PYPI TOKEN"
|
|
251
94
|
```
|
|
252
95
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
### npm
|
|
256
|
-
|
|
257
|
-
The `pack` command generates:
|
|
258
|
-
|
|
259
|
-
- A **main package** that detects the user's platform (`process.platform` + `process.arch`) and delegates to the appropriate binary package.
|
|
260
|
-
- **Platform-specific packages** listed as `optionalDependencies` in the main package, each containing the binary for that platform.
|
|
261
|
-
|
|
262
|
-
Bin upload publishes a main npm package that depend on platform-specific binary packages using [optionalDependencies](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#optionaldependencies). When the main package is installed, the corresponding platform-specific package containing the actual binary is also installed. This allows for downloading and installing only the necessary binary without relying on post-install scripts, which some package managers do not run for dependencies.
|
|
263
|
-
|
|
264
|
-
> **Note:** musl Linux binaries cannot be distinguished from glibc Linux binaries via `process.platform`/`process.arch`, so they cannot be published to npm.
|
|
265
|
-
|
|
266
|
-
### PyPI
|
|
267
|
-
|
|
268
|
-
The `pack` command builds platform-specific wheel (`.whl`) files. Each wheel contains:
|
|
269
|
-
|
|
270
|
-
- A Python wrapper module that locates and executes the bundled binary.
|
|
271
|
-
- Console script entry points for CLI usage.
|
|
96
|
+
### Git flow
|
|
272
97
|
|
|
273
|
-
Bin upload builds and published wheel (`.whl`) packages for each platform-specific tag. Only one PyPi package is created containing the platform-specific wheel files (unlike npm where each binary is published to its own npm package). Tools such as `pip` and `uv` automatically install the correct wheel for the machine installing the package.
|
|
274
|
-
|
|
275
|
-
### GitHub Releases
|
|
276
|
-
|
|
277
|
-
The `pack` command creates `.tar.gz` or `.zip` archives. The `publish` command creates a GitHub release (if one doesn't exist for the tag) and uploads the archives as release assets.
|
|
278
|
-
|
|
279
|
-
### Publishing
|
|
280
|
-
|
|
281
|
-
The [npm](https://www.npmjs.com/) cli is used to publish to npm while [uv](https://docs.astral.sh/uv/) is used to publish to [PyPi](https://pypi.org/).
|
|
282
|
-
|
|
283
|
-
## Environment Variables
|
|
284
|
-
|
|
285
|
-
| Variable | Used By |
|
|
286
|
-
| -------------- | --------------------------- |
|
|
287
|
-
| `NPM_TOKEN` | npm publish authentication |
|
|
288
|
-
| `PYPI_TOKEN` | PyPI publish authentication |
|
|
289
|
-
| `GITHUB_TOKEN` | GitHub API authentication |
|
|
290
|
-
|
|
291
|
-
These can be set in a `.env` file or your CI environment. When using trusted publishers (e.g., GitHub Actions OIDC), tokens may not be required.
|
|
292
|
-
|
|
293
|
-
## Publishing
|
|
294
|
-
|
|
295
|
-
One of the variables available for reference in the configuration file is `gitTag`, a reference to the latest git tag on the current git branch that matches `v\d+\.\d+\.\d+` (the variable is without the leading `v`). Referencing this variable in the configuration allows for git-based release process and bypasses the need to manually update version numbers when releasing.
|
|
296
|
-
|
|
297
|
-
### Local git-based Release Flow
|
|
298
|
-
|
|
299
|
-
```sh
|
|
300
|
-
git add .
|
|
301
|
-
git commit -m "..."
|
|
302
|
-
git tag -a v1.0.0 -m "Release v1.0.0"
|
|
303
|
-
# The tag needs to exist in the remote
|
|
304
|
-
# in order for bin-upload to create a release
|
|
305
|
-
# for the tag and upload assets
|
|
306
|
-
git push --follow-tags
|
|
307
|
-
bin-upload pack
|
|
308
|
-
bin-upload publish
|
|
309
98
|
```
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
The following GitHub action will publish the binary artifacts whenever a version tag is pushed to the repo. You will need to establish trusted publishing between the GitHub repo and npm and/or pypi if publishing to those locations.
|
|
314
|
-
|
|
315
|
-
```yaml
|
|
316
|
-
# .github/workflows/relesae.yml
|
|
317
|
-
name: Release
|
|
318
|
-
|
|
319
|
-
on:
|
|
320
|
-
push:
|
|
321
|
-
tags:
|
|
322
|
-
- "v*"
|
|
323
|
-
|
|
324
|
-
permissions:
|
|
325
|
-
contents: write
|
|
326
|
-
id-token: write
|
|
327
|
-
|
|
328
|
-
jobs:
|
|
329
|
-
release:
|
|
330
|
-
runs-on: ubuntu-latest
|
|
331
|
-
steps:
|
|
332
|
-
- uses: actions/checkout@v4
|
|
333
|
-
|
|
334
|
-
- uses: actions/setup-node@v4
|
|
335
|
-
with:
|
|
336
|
-
node-version: "24"
|
|
337
|
-
registry-url: "https://registry.npmjs.org"
|
|
338
|
-
|
|
339
|
-
- name: Install uv
|
|
340
|
-
uses: astral-sh/setup-uv@v7
|
|
341
|
-
|
|
342
|
-
- name: Build binaries
|
|
343
|
-
run: COMMAND TO BUILD YOUR BINARIES
|
|
344
|
-
|
|
345
|
-
- name: Pack
|
|
346
|
-
run: uvx bin-upload pack
|
|
347
|
-
|
|
348
|
-
- name: Publish
|
|
349
|
-
run: uvx bin-upload publish
|
|
350
|
-
env:
|
|
351
|
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
99
|
+
git push origin main --follow-tags
|
|
100
|
+
bin-upload publish
|
|
352
101
|
```
|
|
353
102
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
From here, the release process is similar to releasing from local machine
|
|
103
|
+
### Non-git flow
|
|
357
104
|
|
|
358
105
|
```sh
|
|
359
|
-
|
|
360
|
-
git commit -m "..."
|
|
361
|
-
git tag -a v1.0.0 -m "Release v1.0.0"
|
|
362
|
-
git push --follow-tags
|
|
106
|
+
bin-upload publish
|
|
363
107
|
```
|
|
364
108
|
|
|
365
|
-
|
|
109
|
+
This publishes the artifacts generated by the `pack` command.
|
|
366
110
|
|
|
367
|
-
|
|
111
|
+
More on the publish command, including how to publish with GitHub actions, can be viewed [here](/publish).
|
|
368
112
|
|
|
369
|
-
|
|
370
|
-
# Install dependencies
|
|
371
|
-
bun install
|
|
113
|
+
## Verify
|
|
372
114
|
|
|
373
|
-
|
|
374
|
-
bun run build
|
|
115
|
+
Once published, install from npm or PyPI and confirm:
|
|
375
116
|
|
|
376
|
-
|
|
377
|
-
|
|
117
|
+
```sh
|
|
118
|
+
# npm
|
|
119
|
+
npx YOUR_PACKAGE ...
|
|
378
120
|
|
|
379
|
-
#
|
|
380
|
-
|
|
381
|
-
bun run fix
|
|
121
|
+
# PyPI
|
|
122
|
+
uvx YOUR_PACKAE ...
|
|
382
123
|
```
|
|
383
124
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
[MIT](LICENSE) — Copyright (c) Derek Worthen
|
|
125
|
+
[Full documentation](https://dworthen.github.io/bin-upload/).
|
package/bin/bin-upload
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-dev/bin-upload-darwin-x64",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Publish binaries to npm, pypi, and github releases.",
|
|
5
5
|
"author": "Derek Worthen <worthend.derek@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "github:dworthen/bin-upload",
|
|
8
|
+
"homepage": "https://dworthen.github.io/bin-upload",
|
|
8
9
|
"keywords": [
|
|
9
10
|
"bin-upload",
|
|
10
11
|
"binary",
|