Skip to content

Commit ce8db65

Browse files
committed
Add test publish workflow and update publish strategy
1 parent 5ddf9e4 commit ce8db65

File tree

2 files changed

+114
-18
lines changed

2 files changed

+114
-18
lines changed

.github/workflows/publish.yml

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,69 @@
1-
name: Publish to npm
1+
name: Publish Packages
22

33
on:
44
push:
55
tags:
6-
- 'v*' # Triggers on tags like v0.4.3, v1.0.0, etc.
6+
- 'v*'
77

88
jobs:
9-
publish:
9+
publish-npm:
10+
name: Publish NPM Packages
1011
runs-on: ubuntu-latest
11-
1212
permissions:
1313
contents: read
14-
id-token: write # Required for npm provenance
15-
14+
id-token: write
1615
steps:
17-
- name: Checkout code
18-
uses: actions/checkout@v4
16+
- uses: actions/checkout@v4
1917

20-
- name: Setup Node.js
21-
uses: actions/setup-node@v4
18+
- uses: actions/setup-node@v4
2219
with:
2320
node-version: '20'
2421
registry-url: 'https://registry.npmjs.org'
25-
22+
2623
- name: Install dependencies
2724
run: npm ci
25+
26+
- name: Run Tests (All Workspaces)
27+
run: npm test --workspaces
28+
29+
- name: Build (All Workspaces)
30+
run: npm run build --workspaces
31+
32+
- name: Publish pmxt-core
33+
run: npm publish --workspace=pmxt-core --provenance --access public
34+
env:
35+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
37+
- name: Publish pmxtjs
38+
run: npm publish --workspace=pmxtjs --provenance --access public
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41+
42+
publish-python:
43+
name: Publish pmxt (Python)
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
2847

48+
- uses: actions/setup-python@v5
49+
with:
50+
python-version: '3.x'
51+
52+
- name: Install build tools & dependencies
53+
run: pip install build twine pytest .
54+
working-directory: sdks/python
55+
2956
- name: Run tests
30-
run: npm test
31-
57+
run: pytest
58+
working-directory: sdks/python
59+
3260
- name: Build package
33-
run: npm run build
34-
35-
- name: Publish to npm
36-
run: npm publish --provenance --access public
61+
run: python -m build
62+
working-directory: sdks/python
63+
64+
- name: Publish to PyPI
65+
run: twine upload dist/*
66+
working-directory: sdks/python
3767
env:
38-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
68+
TWINE_USERNAME: __token__
69+
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}

.github/workflows/test-publish.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Test Publish (Dry Run)
2+
3+
on:
4+
push:
5+
branches:
6+
- multi-language-support
7+
pull_request:
8+
branches:
9+
- multi-language-support
10+
11+
jobs:
12+
test-js-packages:
13+
name: Test JS Packages (Core & SDK)
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: '20'
21+
registry-url: 'https://registry.npmjs.org'
22+
23+
- name: Install dependencies (Root)
24+
run: npm ci
25+
26+
- name: Build All Workspaces
27+
run: npm run build --workspaces
28+
29+
- name: Test All Workspaces
30+
run: npm test --workspaces
31+
32+
- name: Dry Run Publish pmxt-core
33+
run: npm publish --workspace=pmxt-core --dry-run
34+
35+
- name: Dry Run Publish pmxtjs
36+
run: npm publish --workspace=pmxtjs --dry-run
37+
38+
test-python-package:
39+
name: Test Python Package
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- uses: actions/setup-python@v5
45+
with:
46+
python-version: '3.x'
47+
48+
- name: Install build tools & dependencies
49+
run: |
50+
python -m pip install --upgrade pip
51+
pip install build twine pytest
52+
pip install .
53+
working-directory: sdks/python
54+
55+
- name: Run Tests
56+
run: pytest
57+
working-directory: sdks/python
58+
59+
- name: Build Package
60+
run: python -m build
61+
working-directory: sdks/python
62+
63+
- name: Verify Package Metadata
64+
run: twine check dist/*
65+
working-directory: sdks/python

0 commit comments

Comments
 (0)