Skip to content

v0.1.1 - 2024-03-21

v0.1.1 - 2024-03-21 #6

Workflow file for this run

name: build
on:
release:
types: [released]
workflow_dispatch:
defaults:
run:
shell: bash -l {0}
env:
IS_PRERELEASE: ${{ github.event_name == 'workflow_dispatch' }}
jobs:
build-n-publish:
name: Build and publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get prerelease version tags
if: env.IS_PRERELEASE == 'true'
run: |
py_dirty_tag=$(awk '/__version__ = "[[:digit:]+]\.[[:digit:]+]\.[[:digit:]+]\-.+"/ {print $3}' ./bokehmol/_version.py)
py_is_pre=$(test -z "$py_dirty_tag" && echo "false" || echo "true")
js_version_string=$(grep '"version":' ./package.json)
js_dirty_tag=$(echo "$js_version_string" | cut -d- -f2)
js_is_pre=$(test "$js_version_string" == "$js_dirty_tag" && echo "false" || echo "true")
echo "py_is_pre=$py_is_pre" >> $GITHUB_ENV
echo "js_is_pre=$js_is_pre" >> $GITHUB_ENV
- name: Fail if prerelease is not correctly versioned
if: (env.IS_PRERELEASE == 'true') && !( env.py_is_pre && env.js_is_pre )
uses: actions/github-script@v3
with:
script: |
core.setFailed("Versions are not tagged as a prerelease")
- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: 'https://registry.npmjs.org/'
cache: "npm"
- name: Install python with pip
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: "pip"
- name: Install dependencies for packaging
run: |
pip install setuptools wheel build virtualenv twine
- name: Install package
run: |
pip install .
- name: Check python installation
run: |
which python
python --version
pip --version
pip list
- name: Build package
run: |
bash scripts/build.sh
- name: Publish the NPM package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PRE_RELEASE: ${{ env.IS_PRERELEASE }}
- name: Publish the Python package
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_REPOSITORY: 'pypi'
run: twine upload dist/bokehmol*.{tar.gz,whl}