Publish builds to npm.

This commit is contained in:
Rob Blanckaert 2025-03-23 02:20:20 -07:00 committed by Fabian
parent aa5e7b4d83
commit 876ced60da
2 changed files with 25 additions and 1 deletions

View file

@ -28,6 +28,7 @@ jobs:
with:
node-version: '20'
check-latest: true
registry-url: 'https://registry.npmjs.org'
- name: Setup toolchain
run: |
@ -119,6 +120,7 @@ jobs:
with:
name: v86
path: |
package.json
build/libv86*.js
build/libv86*.js.map
build/v86*.wasm
@ -147,6 +149,16 @@ jobs:
- name: Display structure of downloaded files
run: ls -R
- name: Set package.json version
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const fs = require("fs");
const pkg = {...require("./build/package.json"), version: '0.' + String(process.env.GITHUB_RUN_NUMBER)}
console.log(pkg);
fs.writeFileSync("package.json", JSON.stringify(pkg, null, " "), "utf8");
- name: Release to GitHub
uses: ncipollo/release-action@v1
with:
@ -156,3 +168,5 @@ jobs:
body: ${{ github.event.head_commit.message }}
artifacts: "build/libv86*.js,build/libv86*.js.map,build/*.mjs,build/v86*.wasm"
prerelease: true
- run: npm publish --provenance --access public

View file

@ -1,5 +1,15 @@
{
"name": "v86",
"version": "0",
"license": "BSD-2-Clause"
"license": "BSD-2-Clause",
"description": "x86 PC emulator and x86-to-wasm JIT, running in the browser",
"homepage": "https://copy.sh/v86/",
"files": [
"build/libv86*.js",
"build/libv86*.js.map",
"build/*.mjs",
"build/v86*.wasm"
],
"main": "build/libv86.js",
"repository": "github:copy/v86"
}