fancy_gym/.github/workflows/publish-to-pypi.yml

51 lines
1.1 KiB
YAML
Raw Normal View History

2023-10-29 14:11:25 +01:00
name: Publish Python package to PyPI
on:
push:
branches:
- release
2023-10-29 14:11:25 +01:00
jobs:
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0 # This fetches all history for all branches and tags
- name: Check if commit is tagged
run: |
TAG=$(git tag --contains HEAD)
if [ -z "$TAG" ]; then
echo "Commit is not tagged. Failing the workflow."
exit 1
fi
echo "Commit is tagged. Proceeding with the workflow."
2023-10-29 14:11:25 +01:00
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build/setuptools/twine
run: >-
python3 -m
pip install
build setuptools twine
--user
- name: Prevent fallback onto setup.py
run: rm setup.py
2023-10-29 14:11:25 +01:00
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: twine upload dist/*