diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09bc520c31..180578c41c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,11 +37,20 @@ jobs: run: npm run build -- --no-typecheck --no-lint - name: Build Python client bundles run: npm run build-python -- --no-typecheck --no-lint + - run: npm run build-package + - run: npm publish --dry-run + working-directory: dist/package - uses: ./.github/actions/setup-firefox - name: Run JavaScript tests (including WebGL) run: npm test - name: Run JavaScript benchmarks run: npm run benchmark + - name: Upload NPM package as artifact + uses: actions/upload-artifact@v4 + with: + name: npm-package + path: dist/package + if: ${{ runner.os == 'Linux' }} # Builds Python package and runs Python tests # @@ -152,18 +161,28 @@ jobs: dist/*.whl dist/*.tar.gz - python-publish-package: + publish-package: # Only publish package on push to tag or default branch. if: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') }} runs-on: ubuntu-latest needs: + - "client" - "python-build-package" steps: + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.x + registry-url: "https://registry.npmjs.org" - uses: actions/download-artifact@v4 with: pattern: python-wheels-* path: dist merge-multiple: true + - uses: actions/download-artifact@v4 + with: + name: npm-package + path: npm-package # - name: Publish to PyPI (test server) # uses: pypa/gh-action-pypi-publish@54b39fb9371c0b3a6f9f14bb8a67394defc7a806 # 2020-09-25 # with: @@ -175,6 +194,11 @@ jobs: user: __token__ password: ${{ secrets.pypi_token }} if: ${{ startsWith(github.ref, 'refs/tags/v') }} + - name: Publish to NPM registry + run: npm publish + working-directory: npm-package + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} ngauth: strategy: matrix: diff --git a/build_tools/build-package.ts b/build_tools/build-package.ts index a049c2e502..1407c7cbcc 100644 --- a/build_tools/build-package.ts +++ b/build_tools/build-package.ts @@ -86,7 +86,7 @@ async function buildPackage(options: { inplace?: boolean }) { packageJson["scripts"] = { postpack }; } else { delete packageJson["private"]; - delete packageJson["scripts"]; + packageJson["scripts"] = {}; delete packageJson["files"]; } diff --git a/package.json b/package.json index 5fa739e3c0..9d1ecb6441 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,6 @@ "test:watch": "vitest watch", "benchmark": "vitest bench --run", "benchmark:watch": "vitest bench", - "prepublishOnly": "npm run test && npm run build-module", "lint:check": "eslint .", "lint:fix": "eslint . --fix", "format:check": "prettier --cache . -c", @@ -73,7 +72,7 @@ "codemirror": "^5.61.1", "gl-matrix": "3.1.0", "glsl-editor": "^1.0.0", - "ikonate": "mikolajdobrucki/ikonate#a86b4107c6ec717e7877f880a930d1ccf0b59d89", + "ikonate": "github:mikolajdobrucki/ikonate#a86b4107c6ec717e7877f880a930d1ccf0b59d89", "lodash-es": "^4.17.21", "nifti-reader-js": "^0.6.8", "numcodecs": "^0.3.1",