Add continuous deployment to npm (#2776)

This commit is contained in:
Hood Chatham 2022-06-23 22:51:43 -07:00 committed by GitHub
parent 19b2dcf77b
commit 5fde2ae0a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 23 deletions

View File

@ -282,7 +282,7 @@ jobs:
- run:
name: Install requirements
command: |
apk add --no-cache --update python3 make
apk add --no-cache --update python3 make npm
python3 -m pip install awscli
- run:
name: Deploy Github Releases
@ -292,6 +292,11 @@ jobs:
tar cjf pyodide-build-${CIRCLE_TAG}.tar.bz2 pyodide/
ghr -t "${GITHUB_TOKEN}" -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" -c "${CIRCLE_SHA1}" -delete "${CIRCLE_TAG}" ./pyodide-build-${CIRCLE_TAG}.tar.bz2
- run:
name: Deploy to npm
command: |
./tools/deploy_to_npm.sh
- run:
name: Set PYODIDE_BASE_URL
command: PYODIDE_BASE_URL="https://cdn.jsdelivr.net/pyodide/v${CIRCLE_TAG}/full/" make update_base_url

View File

@ -65,27 +65,15 @@ the latest release branch named `stable` (due to ReadTheDocs constraints).
git push upstream stable --force
```
7. Release the Pyodide JavaScript package:
```bash
make clean && PYODIDE_PACKAGES="*" make
cd dist
# If making a major/minor release:
npm publish
npm dist-tag add pyodide@a.b.c next # Label this release as also the latest unstable release
# If making an alpha release:
npm publish --tag next
```
8. Revert the release commit. If making major release, increment the version to
the next development version specified by Semantic Versioning.
7. Revert the release commit. If making a major release, increment the version
to the next development version specified by Semantic Versioning.
```sh
# If you just released 0.22.0, then set the next version to 0.23.0
./tools/bump_version.py --new-version 0.23.0.dev0
```
9. Update these instructions with any relevant changes.
8. Update these instructions with any relevant changes.
### Making a minor release
@ -116,13 +104,6 @@ Then follow the relevant steps from {ref}`release-instructions`.
Name the first alpha release `x.x.xa1` and in subsequent alphas increment the
final number. Follow the relevant steps from {ref}`release-instructions`.
For the node package make sure to use `npm publish --tag next` to avoid setting
the alpha version as the stable release. If you accidentally publish the alpha
release over the stable `latest` tag, you can fix it with:
`npm dist-tag add pyodide@a.b.c latest` where `a.b.c` should be the latest
stable version. Then use `npm dist-tag add pyodide@a.b.c-alpha.d next` to set
the `next` tag to point to the just-published alpha release.
### Fixing documentation for a released version
Cherry pick the corresponding documentation commits to the `stable` branch. Use

17
tools/deploy_to_npm.sh Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -e
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
cd dist/
PACKAGE_NAME=$(node -p "require('./package.json').name")
JS_VERSION=$(node -p "require('./package.json').version")
if [[ ${JS_VERSION} =~ [alpha|beta|rc|dev] ]]; then
echo "Publishing an unstable release"
npm publish --tag next
else
echo "Publishing a stable release"
npm publish
npm dist-tag add "$PACKAGE_NAME"@"$JS_VERSION" next
fi