Skip to content

Commit fda1e83

Browse files
committed
feat: Add NPM release capabilities.
Update the release workflow to also release the frontend package to NPM at the same time as the backend package gets published to PyPI. We don't run the full semantic rlease process on the frontend because we already did that with python-semantic-release so we just need to update the frontend version and release it.
1 parent c5e306c commit fda1e83

2 files changed

Lines changed: 31 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ on:
55
branches: [main]
66

77
jobs:
8-
run_tests:
9-
uses: ./.github/workflows/ci.yml
8+
run_backend_tests:
9+
uses: ./.github/workflows/backend-ci.yml
1010

1111
release:
12-
needs: run_tests
12+
needs: run_backend_tests
1313
runs-on: ubuntu-latest
1414
if: github.ref_name == 'main'
1515
concurrency:
@@ -27,7 +27,7 @@ jobs:
2727
# while the workflow was running, which prevents accidentally releasing un-evaluated
2828
# changes.
2929
- name: Setup | Checkout Repository on Release Branch
30-
uses: actions/checkout@v4
30+
uses: actions/checkout@v6
3131
with:
3232
ref: ${{ github.ref_name }}
3333

@@ -64,8 +64,9 @@ jobs:
6464

6565
outputs:
6666
released: ${{ steps.release.outputs.released || 'false' }}
67+
version: ${{ steps.release.outputs.version }}
6768

68-
publish:
69+
publish_to_pypi:
6970
# 1. Separate out the publish step from the github release step to run each step at
7071
# the least amount of token privilege
7172
# 2. Also, publishing can fail, and its better to have a separate job if you need to retry
@@ -92,3 +93,28 @@ jobs:
9293
packages-dir: backend/dist
9394
user: __token__
9495
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}
96+
97+
publish_to_npm:
98+
runs-on: ubuntu-latest
99+
needs: release
100+
if: github.ref_name == 'main' && needs.release.outputs.released == 'true'
101+
permissions:
102+
contents: read
103+
id-token: write
104+
105+
steps:
106+
- name: Setup | Checkout Repository on Release Ref
107+
uses: actions/checkout@v6
108+
with:
109+
ref: ${{ github.sha }}
110+
111+
- name: Setup Node.js
112+
uses: actions/setup-node@v6
113+
with:
114+
node-version-file: './frontend/.nvmrc'
115+
116+
- name: Update the package version and publish
117+
run: |
118+
npm version ${{ needs.release.outputs.version }}
119+
npm publish
120+
working-directory: './frontend'

0 commit comments

Comments
 (0)