Skip to content

feat(npm): publish forge to npm for each arch #11047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
crates/cheatcodes/assets/*.json linguist-generated
testdata/cheats/Vm.sol linguist-generated
bun.lock linguist-generated

# See <https://git-scm.com/docs/gitattributes#_defining_a_custom_hunk_header>
*.rs diff=rust
Expand Down
54 changes: 54 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,60 @@ jobs:
${{ steps.artifacts.outputs.foundry_attestation }}
${{ steps.man.outputs.foundry_man }}

- name: Setup Bun (npm)
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
bun-version: "latest"
scope: "@foundry-rs"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
working-directory: ./npm
run: bun install --frozen-lockfile

- name: Publish @foundry-rs/forge-${{ matrix.platform }}-${{ matrix.arch }} (npm)
shell: bash
working-directory: ./npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_REGISTRY_URL: "https://registry.npmjs.org"
ARCH: ${{ matrix.arch }}
TARGET: ${{ matrix.target }}
PLATFORM: ${{ matrix.platform }}
OUT_DIR: target/${{ matrix.target }}/${{ env.PROFILE }}
VERSION_NAME: ${{ (env.IS_NIGHTLY == 'true' && 'nightly') || needs.prepare.outputs.tag_name }}
run: |-
bun ./scripts/prepublish.ts
bun run ./scripts/publish.ts ./@foundry-rs/forge-${{ env.PLATFORM }}-${{ env.ARCH }}

publish-npm:
name: Publish @foundry-rs/forge
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76
with:
bun-version: "latest"
scope: "@foundry-rs"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
working-directory: ./npm
run: bun install --frozen-lockfile

- name: Publish @foundry-rs/forge
shell: bash
working-directory: ./npm
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_REGISTRY_URL: "https://registry.npmjs.org"
run: |-
bun ./scripts/prepublish.ts
bun run ./scripts/publish.ts ./@foundry-rs/forge

cleanup:
name: Release cleanup
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ CLAUDE.md
node_modules
dist
bin
_
_
*.tgz
28 changes: 13 additions & 15 deletions dprint.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
{
"$schema": "https://raw.githubusercontent.com/dprint/dprint/refs/heads/main/website/src/assets/schemas/v0.json",
"incremental": true,
"indentWidth": 2,
"useTabs": false,
"includes": [
"*.md",
"*.{toml}",
"Dockerfile",
"*.{yml,yaml}",
"*.{json,jsonc}",
"*.{js,cjs,mjs,d.ts,d.cts,d.mts,ts,tsx,jsx}"
],
"excludes": [
"!npm/**/*.{json,md,toml}",
"!npm/**/*.{js,cjs,mjs,d.ts,d.cts,d.mts,ts,tsx,jsx}",
"**/_",
"dprint.json",
"**/abi",
"**/build",
"**/abi/**",
"**/target",
"**/test/**",
"**/*.min.*",
"**/dist/**",
"testdata/**",
"**/tests/**",
"node_modules",
"changelog.json",
"**/test-data/**",
"**/node_modules",
"**/cheatcodes/**",
"**/node_modules/**",
".github/scripts/**",
".github/ISSUE_TEMPLATE/**"
],
Expand All @@ -40,13 +36,15 @@
"textWrap": "maintain"
},
"toml": {
"columnWidth": 100
"lineWidth": 100
},
"json": {
"useTabs": false,
"lineWidth": 1,
"indentWidth": 2,
"useTabs": false,
"trailingCommas": "never",
"array.preferSingleLine": true
"preferSingleLine": false,
"array.preferSingleLine": false
},
"typescript": {
"useTabs": false,
Expand All @@ -59,4 +57,4 @@
"exportDeclaration.sortTypeOnlyExports": "none",
"importDeclaration.sortTypeOnlyImports": "none"
}
}
}
8 changes: 8 additions & 0 deletions npm/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
NODE_ENV="development"

NPM_TOKEN=""
NPM_REGISTRY_URL=""
NPM_USERNAME="foundry-rs"

PLATFORM_NAME=""
ARCH=""
38 changes: 38 additions & 0 deletions npm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# dependencies (bun install)
node_modules

# output
out
dist
*.tgz

# code coverage
coverage
*.lcov

# logs
logs
_.log
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# caches
.eslintcache
.cache
*.tsbuildinfo

# IntelliJ based IDEs
.idea

# Finder (MacOS) folder config
.DS_Store

forge/*/bin/forge
@foundry-rs/*/bin/
test/workspace/bun.lock
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge-darwin-amd64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

This is the macOS 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
35 changes: 35 additions & 0 deletions npm/@foundry-rs/forge-darwin-amd64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@foundry-rs/forge-darwin-amd64",
"version": "1.2.3",
"type": "module",
"homepage": "https://getfoundry.sh",
"description": "Fast and flexible Ethereum testing framework (macOS amd64)",
"bin": {
"forge": "./bin/forge"
},
"os": [
"darwin"
],
"cpu": [
"x64"
],
"files": [
"bin"
],
"engines": {
"node": ">=20"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
},
"keywords": [
"foundry",
"testing",
"ethereum",
"solidity",
"blockchain",
"smart-contracts"
]
}
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge-darwin-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

This is the macOS ARM 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
35 changes: 35 additions & 0 deletions npm/@foundry-rs/forge-darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@foundry-rs/forge-darwin-arm64",
"version": "1.3.0",
"type": "module",
"homepage": "https://getfoundry.sh",
"description": "Fast and flexible Ethereum testing framework (macOS arm64)",
"bin": {
"forge": "./bin/forge"
},
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"files": [
"bin"
],
"engines": {
"node": ">=20"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
},
"keywords": [
"foundry",
"testing",
"ethereum",
"solidity",
"blockchain",
"smart-contracts"
]
}
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge-linux-amd64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

This is the Linux 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
35 changes: 35 additions & 0 deletions npm/@foundry-rs/forge-linux-amd64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@foundry-rs/forge-linux-amd64",
"version": "1.2.3",
"type": "module",
"homepage": "https://getfoundry.sh",
"description": "Fast and flexible Ethereum testing framework (Linux amd64)",
"bin": {
"forge": "./bin/forge"
},
"os": [
"linux"
],
"cpu": [
"x64"
],
"files": [
"bin"
],
"engines": {
"node": ">=20"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
},
"keywords": [
"foundry",
"testing",
"ethereum",
"solidity",
"blockchain",
"smart-contracts"
]
}
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge-linux-arm64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

This is the Linux ARM 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
35 changes: 35 additions & 0 deletions npm/@foundry-rs/forge-linux-arm64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@foundry-rs/forge-linux-arm64",
"version": "1.2.3",
"type": "module",
"homepage": "https://getfoundry.sh",
"description": "Fast and flexible Ethereum testing framework (Linux arm64)",
"bin": {
"forge": "./bin/forge"
},
"os": [
"linux"
],
"cpu": [
"arm64"
],
"files": [
"bin"
],
"engines": {
"node": ">=20"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
},
"keywords": [
"foundry",
"testing",
"ethereum",
"solidity",
"blockchain",
"smart-contracts"
]
}
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge-win32-amd64/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

This is the Windows 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
35 changes: 35 additions & 0 deletions npm/@foundry-rs/forge-win32-amd64/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "@foundry-rs/forge-win32-amd64",
"version": "1.2.3",
"type": "module",
"homepage": "https://getfoundry.sh",
"description": "Fast and flexible Ethereum testing framework (Windows amd64)",
"bin": {
"forge": "./bin/forge"
},
"os": [
"win32"
],
"cpu": [
"x64"
],
"files": [
"bin"
],
"engines": {
"node": ">=20"
},
"license": "MIT OR Apache-2.0",
"repository": {
"directory": "npm",
"url": "https://github.com/foundry-rs/foundry"
},
"keywords": [
"foundry",
"testing",
"ethereum",
"solidity",
"blockchain",
"smart-contracts"
]
}
4 changes: 4 additions & 0 deletions npm/@foundry-rs/forge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# forge

A CLI tool for testing, building, and deploying your smart contracts.
See <https://getfoundry.sh/forge/overview> for details.
Loading
Loading