change test dep and bump version (#293) #66
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "python/pyproject.toml" | |
workflow_dispatch: | |
env: | |
POETRY_VERSION: "1.4.2" | |
jobs: | |
if_release: | |
# Disallow publishing from branches that aren't `main`. | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
# Python Build | |
- name: Install poetry | |
run: pipx install poetry==$POETRY_VERSION | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.11" | |
cache: "poetry" | |
- name: Build project for distribution | |
run: cd python && poetry build | |
# JS Build | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "yarn" | |
cache-dependency-path: "js/yarn.lock" | |
- name: Install dependencies | |
run: cd js && yarn install --immutable | |
- name: Build | |
run: cd js && yarn run build | |
- name: Check Version | |
id: check-version | |
run: | | |
cd python && echo version=$(poetry version --short) >> $GITHUB_OUTPUT | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: | | |
- "python/dist/*" | |
- "js/dist/*" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: false | |
generateReleaseNotes: true | |
tag: v${{ steps.check-version.outputs.version }} | |
commit: main | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
packages-dir: "python/dist" | |
- name: Publish package to NPM | |
run: | | |
cd js | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | |
yarn publish --non-interactive |