Skip to content

Fix: pypa updated variables to use - #3

Fix: pypa updated variables to use -

Fix: pypa updated variables to use - #3

Workflow file for this run

name: Publish to PyPI
on:
release:
types: [published]
push:
branches:
- main
jobs:
build-publish:
runs-on: ubuntu-latest
# This ensures that the publish action only runs in the main repository
# rather than forks
if: github.repository_owner == 'pyopensci'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# This fetch element is only important if you are use SCM based
# versioning (that looks at git tags to gather the version)
fetch-depth: 100
# Need the tags so that setuptools-scm can form a valid version number
- name: Fetch git tags
run: git fetch origin 'refs/tags/*:refs/tags/*'
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install Hatch
run: |
pipx install hatch
pip list
- name: Build package using Hatch
run: |
hatch build
echo ""
echo "Generated files:"
ls -lh dist/
- name: Publish package on test PyPI on merge in main branch # optional
# Test push to test pypi on merge to main
if: github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@release/v1
with:
# Haven't setup trusted workflow on test pypi yet
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository-url: https://test.pypi.org/legacy/
# Allow existing releases on test PyPI without errors.
# NOT TO BE USED in PyPI!
skip-existing: true
- name: Publish package to PyPI
# Only publish to real PyPI on release
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@release/v1