Add pydantic version #45
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: Publish Python 🐍 distributions 📦 to PyPI | |
on: | |
push: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
publish: | |
# Only run publishing when the commit message contains [bumpversion] | |
# Auto-generated branches will be [bB]umpversion/<version>, so we also check for that. | |
if: | | |
contains(github.event.head_commit.message, '[bumpversion]') || | |
contains(github.event.head_commit.message, 'bumpversion/') || | |
contains(github.event.head_commit.message, 'Bumpversion/') | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/meerkat-ml | |
# TODO: Make permissions more restrictive | |
permissions: write-all | |
env: | |
commitmsg: ${{ github.event.head_commit.message }} | |
HF_TOKEN: ${{ secrets.HF_TOKEN }} | |
NODE_OPTIONS: "--max_old_space_size=4096" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
# Setup .npmrc file to publish to npm | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '16.x' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip | |
- name: Print commit message | |
run: echo "Commit MSG = ${commitmsg}" | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[all]" | |
- name: Npm install and build examples | |
# No need to build here, since we will build in the next step. | |
run: | | |
cd meerkat/interactive/app | |
npm i | |
python -m meerkat.interactive.svelte | |
cd ../../../ | |
- name: Build PyPI | |
run: | | |
python setup.py upload --skip-upload | |
twine check dist/* | |
- name: Publish distribution to npm | |
run: | | |
cd meerkat/interactive/app | |
npm ci | |
npm run package | |
npm publish package/ | |
cd ../../../ | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
verbose: true | |
- name: Get version | |
run: | | |
export MEERKAT_VERSION=$(grep -o '".*"' meerkat/version.py | sed 's/"//g') | |
echo "MEERKAT_VERSION=${MEERKAT_VERSION}" >> $GITHUB_ENV | |
- name: Verify version | |
run: echo ${{ env.MEERKAT_VERSION }} | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ env.MEERKAT_VERSION }} |