Publish to PyPI #2
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 to PyPI | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Setup Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' | |
- name: Install packages | |
run: >- | |
python -m pip install build twine | |
- name: Get version from file | |
id: version | |
run: echo "version=$(cat version)" >> $GITHUB_OUTPUT | |
- name: Validate package versions | |
run: >- | |
test $GITHUB_REF == ${{ steps.version.outputs.version }} | |
- name: Build | |
run: >- | |
python -m build mkdocs | |
- name: Upload | |
run: >- | |
twine upload mkdocs/dist/* ${{ secrets.PYPI_API_TOKEN }} |