diff --git a/.github/workflows/upload-release.yml b/.github/workflows/upload-release.yml new file mode 100644 index 0000000..bc692d3 --- /dev/null +++ b/.github/workflows/upload-release.yml @@ -0,0 +1,24 @@ +name: Upload standalone file to GitHub Releases +on: + release: + types: [created] +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + steps: + - uses: actions/checkout@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4 + - uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4 + with: + node-version: 20 + registry-url: 'https://registry.npmjs.org' + cache: npm + - run: npm install -g npm + - run: npm ci + - run: npm run build + - run: npm run build:release + - run: gh release upload ${{ github.event.release.tag_name }} test/build/noble-ed25519.min.js test/build/noble-ed25519.min.js.gz + env: + GH_TOKEN: ${{ github.token }} diff --git a/package.json b/package.json index ddc31a2..5557b44 100644 --- a/package.json +++ b/package.json @@ -14,12 +14,13 @@ "sideEffects": false, "scripts": { "build": "tsc", - "build:release": "rollup -c rollup.config.js", + "build:min": "cd test/build; npm install; npm run terser", + "build:mingz": "npm run --silent build:min | gzip -c8", + "build:release": "npm run --silent build:min > test/build/noble-ed25519.min.js; npm run --silent build:mingz > test/build/noble-ed25519.min.js.gz", "test": "node test/index.test.js", "test:webcrypto": "node test/ed25519.webcrypto.test.js", "bench": "node test/benchmark/benchmark.js", - "min": "cd test/build; npm install; npm run terser", - "loc": "echo \"`npm run --silent min | wc -c` symbols `wc -l < index.ts` LOC, `npm run --silent min | gzip -c8 | wc -c`B gzipped\"" + "loc": "echo \"`npm run --silent build:min | wc -c` symbols `wc -l < index.ts` LOC, `npm run --silent build:mingz | wc -c`B gzipped\"" }, "author": "Paul Miller (https://paulmillr.com)", "homepage": "https://paulmillr.com/noble/",