v2.3.2-dev0 #18
Workflow file for this run
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: CD to pypi | |
on: | |
release: | |
types: [ published, unpublished ] | |
jobs: | |
build: | |
name: Build distribution 📦 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install pypa/build | |
run: >- | |
python3 -m | |
pip install | |
build | |
--user | |
- name: Build a binary wheel and a source tarball | |
run: python3 -m build | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
retention-days: 7 # Set retention period for artifacts | |
publish-to-testpypi: | |
needs: build | |
if: "contains(github.event.release.name, 'rc') || contains(github.event.release.name, 'dev')" | |
name: Publish 📦 to TestPyPI | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/ghetool | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish 📦 to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
user: __token__ | |
password: ${{ secrets.TESTPYPI }} | |
publish-to-pypi: | |
needs: build | |
if: "!contains(github.event.release.name, 'rc') && !contains(github.event.release.name, 'dev')" | |
name: Publish 📦 to PyPI | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/ghetool | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://upload.pypi.org/legacy/ | |
user: __token__ | |
password: ${{ secrets.PYPI }} |