Skip to content

Commit f1d68e2

Browse files
authored
Merge pull request #360 from plotly/seperate-package-npm
Manage NPM packages properly
2 parents 7b77321 + 96e9c7c commit f1d68e2

File tree

3 files changed

+40
-11
lines changed

3 files changed

+40
-11
lines changed

.github/workflows/build.yml

+16-4
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ jobs:
3636
source .venv/bin/activate
3737
npm run build
3838
shell: bash
39-
- name: Generate distribution
39+
- name: Generate Python distribution
4040
run: |
4141
source .venv/bin/activate
4242
npm run dist
43-
npm pack && mv *.tgz dist/
43+
shell: bash
44+
- name: Build npm package
45+
run: |
46+
source .venv/bin/activate
47+
npm pack
48+
mkdir -p npm-dist
49+
mv *.tgz npm-dist/
4450
shell: bash
4551
- name: Validate distribution
4652
run: |
@@ -50,8 +56,14 @@ jobs:
5056
uv pip install "${WHL_FILE}[dev]"
5157
npm run test
5258
shell: bash
53-
- name: Upload built distributions
59+
- name: Upload Python distributions
5460
uses: actions/upload-artifact@v4
5561
with:
56-
name: package-distributions
62+
name: python-distributions
5763
path: dist/
64+
65+
- name: Upload npm package
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: npm-package
69+
path: npm-dist/

.github/workflows/publish-to-pypi.yml

+15-3
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,24 @@ jobs:
2323
steps:
2424
- name: Checkout code
2525
uses: actions/checkout@v4
26-
- name: Download built distributions
26+
- name: Download Python distributions
2727
uses: actions/download-artifact@v4
2828
with:
29-
name: package-distributions
29+
name: python-distributions
3030
path: dist/
3131
- name: Publish package distributions to PyPI
3232
uses: pypa/gh-action-pypi-publish@release/v1
3333
with:
34-
password: ${{ secrets.PYPI_API_TOKEN }}
34+
password: ${{ secrets.PYPI_API_TOKEN }}
35+
36+
- name: Download npm package
37+
uses: actions/download-artifact@v4
38+
with:
39+
name: npm-package
40+
path: npm-dist/
41+
- name: Publish to npm
42+
run: |
43+
npm publish npm-dist/*.tgz --access public
44+
env:
45+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46+
shell: bash

.github/workflows/release.yml

+9-4
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@ jobs:
2121
steps:
2222
- name: Checkout repo
2323
uses: actions/checkout@v4
24-
- name: Download built distributions
24+
- name: Download Python distributions
2525
uses: actions/download-artifact@v4
2626
with:
27-
name: package-distributions
27+
name: python-distributions
2828
path: dist/
29+
- name: Download npm package
30+
uses: actions/download-artifact@v4
31+
with:
32+
name: npm-package
33+
path: npm-dist/
2934
- name: Upload GitHub Release
3035
uses: ncipollo/release-action@v1
3136
with:
32-
artifacts: "dist/*.whl,dist/*.tar.gz"
33-
draft: true
37+
artifacts: "dist/*.whl,dist/*.tar.gz,npm-dist/*.tgz"
38+
draft: true

0 commit comments

Comments
 (0)