Skip to content

nightly API update (#216) #12

nightly API update (#216)

nightly API update (#216) #12

Workflow file for this run

# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Release
on:
push:
tags: [ 'v*' ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check release version
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# extract package version from setup.py
PACKAGE_VERSION=$(grep '^VERSION' setup.py | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+')
if [[ $VERSION != $PACKAGE_VERSION ]]; then
echo "Failed to publish release v${VERSION}."
echo "Make sure the release version matches the version specified in setup.py (currently ${PACKAGE_VERSION})"
exit 1
fi
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish GitHub release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}