Skip to content

Commit cc48d9d

Browse files
Napi release
1 parent 6ff49b1 commit cc48d9d

7 files changed

Lines changed: 119 additions & 75 deletions

File tree

.github/workflows/publish-evm.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,16 @@ jobs:
136136
run: ls -R ./npm
137137
shell: bash
138138

139+
- name: Publish native packages
140+
run: pnpm run release:napi -- --tag=evm --publish-branch=evm --no-git-checks
141+
env:
142+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
143+
139144
- name: Publish to NPM
140145
run: |
141146
pnpm run release --scope=@mainsail/evm -- --publish-branch=evm --tag=evm --no-git-checks
142147
env:
143148
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
144-
npm_config_tag: evm
145149

146150
# - name: Set dist-tag latest
147151
# run: |

.github/workflows/publish-rc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,11 @@ jobs:
132132
run: ls -R ./npm
133133
shell: bash
134134

135+
- name: Publish native packages
136+
run: pnpm run release:napi -- --tag=rc --publish-branch=develop --no-git-checks
137+
env:
138+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
139+
135140
- name: Publish to NPM
136141
run: |
137142
pnpm run release -- --publish-branch=develop --tag=rc --no-git-checks

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"prettier:dry": "prettier --check \"./*.{ts,js,json,md}\" \"./packages/**/*.{ts,js,json,md}\"",
3737
"references": "node ./scripts/references/update-references.js",
3838
"release": "lerna run release --concurrency=1",
39+
"release:napi": "bash ./scripts/publish-evm-native.sh",
3940
"setup": "pnpm install && pnpm run build",
4041
"sort": "sort-package-json \"package.json\" \"packages/*/package.json\"",
4142
"sort:dry": "sort-package-json --check \"package.json\" \"packages/*/package.json\"",
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"name": "@mainsail/evm-linux-arm64-gnu",
3-
"version": "0.0.1-evm.48",
4-
"os": [
5-
"linux"
6-
],
7-
"cpu": [
8-
"arm64"
9-
],
10-
"main": "evm.linux-arm64-gnu.node",
11-
"files": [
12-
"evm.linux-arm64-gnu.node"
13-
],
14-
"license": "MIT",
15-
"engines": {
16-
"node": ">= 10"
17-
},
18-
"libc": [
19-
"glibc"
20-
]
21-
}
2+
"name": "@mainsail/evm-linux-arm64-gnu",
3+
"version": "0.0.1-evm.48",
4+
"os": [
5+
"linux"
6+
],
7+
"cpu": [
8+
"arm64"
9+
],
10+
"main": "evm.linux-arm64-gnu.node",
11+
"files": [
12+
"evm.linux-arm64-gnu.node"
13+
],
14+
"license": "MIT",
15+
"engines": {
16+
"node": ">= 10"
17+
},
18+
"libc": [
19+
"glibc"
20+
]
21+
}
Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
{
2-
"name": "@mainsail/evm-linux-x64-gnu",
3-
"version": "0.0.1-evm.48",
4-
"os": [
5-
"linux"
6-
],
7-
"cpu": [
8-
"x64"
9-
],
10-
"main": "evm.linux-x64-gnu.node",
11-
"files": [
12-
"evm.linux-x64-gnu.node"
13-
],
14-
"license": "MIT",
15-
"engines": {
16-
"node": ">= 10"
17-
},
18-
"libc": [
19-
"glibc"
20-
]
21-
}
2+
"name": "@mainsail/evm-linux-x64-gnu",
3+
"version": "0.0.1-evm.48",
4+
"os": [
5+
"linux"
6+
],
7+
"cpu": [
8+
"x64"
9+
],
10+
"main": "evm.linux-x64-gnu.node",
11+
"files": [
12+
"evm.linux-x64-gnu.node"
13+
],
14+
"license": "MIT",
15+
"engines": {
16+
"node": ">= 10"
17+
},
18+
"libc": [
19+
"glibc"
20+
]
21+
}

packages/evm/package.json

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
11
{
2-
"name": "@mainsail/evm",
3-
"version": "0.0.1-evm.48",
4-
"description": "EVM for the Mainsail blockchain",
5-
"license": "GPL-3.0-only",
6-
"contributors": [],
7-
"main": "index.js",
8-
"types": "index.d.ts",
9-
"scripts": {
10-
"artifacts": "napi artifacts",
11-
"build-napi": "napi build --platform --output-dir ./ --manifest-path bindings/Cargo.toml --release",
12-
"build-napi:debug": "napi build --platform --output-dir ./ --manifest-path bindings/Cargo.toml",
13-
"build-rs": "pnpm run clean && pnpm run build-napi",
14-
"clean": "rm -f index.js && rm -f index.d.ts && rm -f evm.*.node && rm -rf target",
15-
"prepublishOnly": "napi prepublish -t pnpm",
16-
"release": "pnpm publish --access public",
17-
"test": "cargo test --release",
18-
"test:coverage": "mkdir -p coverage && cargo llvm-cov --lcov --output-path coverage/lcov.info --remap-path-prefix",
19-
"test:coverage:html": "mkdir -p coverage && cargo llvm-cov --html --output-dir coverage/ --remap-path-prefix",
20-
"version": "napi version"
21-
},
22-
"devDependencies": {
23-
"@napi-rs/cli": "3.6.2"
24-
},
25-
"engines": {
26-
"node": ">=24"
27-
},
28-
"napi": {
29-
"binaryName": "evm",
30-
"targets": [
31-
"aarch64-unknown-linux-gnu",
32-
"x86_64-unknown-linux-gnu"
33-
]
34-
}
35-
}
2+
"name": "@mainsail/evm",
3+
"version": "0.0.1-evm.48",
4+
"description": "EVM for the Mainsail blockchain",
5+
"license": "GPL-3.0-only",
6+
"contributors": [],
7+
"main": "index.js",
8+
"types": "index.d.ts",
9+
"scripts": {
10+
"artifacts": "napi artifacts",
11+
"build-napi": "napi build --platform --output-dir ./ --manifest-path bindings/Cargo.toml --release",
12+
"build-napi:debug": "napi build --platform --output-dir ./ --manifest-path bindings/Cargo.toml",
13+
"build-rs": "pnpm run clean && pnpm run build-napi",
14+
"clean": "rm -f index.js && rm -f index.d.ts && rm -f evm.*.node && rm -rf target",
15+
"release": "pnpm publish --access public",
16+
"test": "cargo test --release",
17+
"test:coverage": "mkdir -p coverage && cargo llvm-cov --lcov --output-path coverage/lcov.info --remap-path-prefix",
18+
"test:coverage:html": "mkdir -p coverage && cargo llvm-cov --html --output-dir coverage/ --remap-path-prefix",
19+
"version": "napi version"
20+
},
21+
"devDependencies": {
22+
"@napi-rs/cli": "3.6.2"
23+
},
24+
"engines": {
25+
"node": ">=24"
26+
},
27+
"napi": {
28+
"binaryName": "evm",
29+
"targets": [
30+
"aarch64-unknown-linux-gnu",
31+
"x86_64-unknown-linux-gnu"
32+
]
33+
},
34+
"optionalDependencies": {
35+
"@mainsail/evm-linux-arm64-gnu": "0.0.1-evm.48",
36+
"@mainsail/evm-linux-x64-gnu": "0.0.1-evm.48"
37+
}
38+
}

scripts/publish-evm-native.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Publishes the EVM native platform packages (@mainsail/evm-*) to npm.
5+
#
6+
# Run this BEFORE `pnpm run release`. It first lets napi sync the platform package versions and the
7+
# main package's optionalDependencies (without publishing them or creating a GitHub release), then
8+
# publishes each platform package, forwarding every flag passed on the command line straight to
9+
# `pnpm publish`. `napi prepublish` would otherwise publish them with a bare `npm publish` (no
10+
# --tag), which npm rejects for prerelease versions, and pnpm strips npm_config_* from the
11+
# lifecycle-script env so a dist-tag cannot be injected that way.
12+
#
13+
# Usage:
14+
# pnpm run release:napi -- --tag=evm --publish-branch=evm --no-git-checks
15+
# pnpm run release:napi -- --tag=rc --publish-branch=develop --no-git-checks
16+
17+
cd "$(dirname "${BASH_SOURCE[0]}")/../packages/evm"
18+
19+
# `pnpm run release:napi -- <flags>` forwards the literal `--` separator into "$@" as well; drop it
20+
# so the flags reach `pnpm publish` as options instead of being treated as a positional argument.
21+
if [ "${1:-}" = "--" ]; then
22+
shift
23+
fi
24+
25+
# Sync versions + optionalDependencies only; we publish the platform packages ourselves below.
26+
pnpm exec napi prepublish -t pnpm --skip-optional-publish --no-gh-release
27+
28+
for dir in npm/*/; do
29+
echo "Publishing ${dir%/} $*"
30+
(cd "$dir" && pnpm publish --access public "$@")
31+
done

0 commit comments

Comments
 (0)