Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 10 additions & 6 deletions .github/workflows/publish-evm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@ permissions:
contents: read

on:
push:
branches:
- "evm"
pull_request:
types: [opened, synchronize, reopened]

jobs:
build:
if: contains(github.event.head_commit.message, 'release:') && contains(github.event.head_commit.message, 'evm')
# if: contains(github.event.head_commit.message, 'release:') && contains(github.event.head_commit.message, 'evm')

strategy:
fail-fast: false
Expand Down Expand Up @@ -78,7 +77,7 @@ jobs:

publish:
name: Publish
if: contains(github.event.head_commit.message, 'release:') && contains(github.event.head_commit.message, 'evm')
# if: contains(github.event.head_commit.message, 'release:') && contains(github.event.head_commit.message, 'evm')
runs-on: ubuntu-latest
needs:
- build
Expand Down Expand Up @@ -134,7 +133,12 @@ jobs:

- name: Publish to NPM
run: |
pnpm run release -- --publish-branch=evm --tag=evm --no-git-checks
pnpm run release --no-bail -- --publish-branch=evm --tag=evm --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- name: Publish native packages
run: pnpm run release:napi -- --tag=evm --publish-branch=evm --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/publish-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ jobs:
run: ls -R ./npm
shell: bash

- name: Publish native packages
run: pnpm run release:napi -- --tag=rc --publish-branch=develop --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- name: Publish to NPM
run: |
pnpm run release -- --publish-branch=develop --tag=rc --no-git-checks
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"prettier:dry": "prettier --check \"./*.{ts,js,json,md}\" \"./packages/**/*.{ts,js,json,md}\"",
"references": "node ./scripts/references/update-references.js",
"release": "lerna run release --concurrency=1",
"release:napi": "bash ./scripts/publish-evm-native.sh",
"setup": "pnpm install && pnpm run build",
"sort": "sort-package-json \"package.json\" \"packages/*/package.json\"",
"sort:dry": "sort-package-json --check \"package.json\" \"packages/*/package.json\"",
Expand Down
1 change: 0 additions & 1 deletion packages/evm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"build-napi:debug": "napi build --platform --output-dir ./ --manifest-path bindings/Cargo.toml",
"build-rs": "pnpm run clean && pnpm run build-napi",
"clean": "rm -f index.js && rm -f index.d.ts && rm -f evm.*.node && rm -rf target",
"prepublishOnly": "napi prepublish -t pnpm",
"release": "pnpm publish --access public",
"test": "cargo test --release",
"test:coverage": "mkdir -p coverage && cargo llvm-cov --lcov --output-path coverage/lcov.info --remap-path-prefix",
Expand Down
31 changes: 31 additions & 0 deletions scripts/publish-evm-native.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
set -euo pipefail

# Publishes the EVM native platform packages (@mainsail/evm-*) to npm.
#
# Run this BEFORE `pnpm run release`. It first lets napi sync the platform package versions and the
# main package's optionalDependencies (without publishing them or creating a GitHub release), then
# publishes each platform package, forwarding every flag passed on the command line straight to
# `pnpm publish`. `napi prepublish` would otherwise publish them with a bare `npm publish` (no
# --tag), which npm rejects for prerelease versions, and pnpm strips npm_config_* from the
# lifecycle-script env so a dist-tag cannot be injected that way.
#
# Usage:
# pnpm run release:napi -- --tag=evm --publish-branch=evm --no-git-checks
# pnpm run release:napi -- --tag=rc --publish-branch=develop --no-git-checks

cd "$(dirname "${BASH_SOURCE[0]}")/../packages/evm"

# `pnpm run release:napi -- <flags>` forwards the literal `--` separator into "$@" as well; drop it
# so the flags reach `pnpm publish` as options instead of being treated as a positional argument.
if [ "${1:-}" = "--" ]; then
shift
fi

# Sync versions + optionalDependencies only; we publish the platform packages ourselves below.
pnpm exec napi prepublish -t pnpm --skip-optional-publish --no-gh-release

for dir in npm/*/; do
echo "Publishing ${dir%/} $*"
(cd "$dir" && pnpm publish --access public "$@")
done
Loading