-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update pyproject.toml to dynamically version based on git
Add this repo to trusted publishers on testpypi. Build package only once Update publish.yml Remove outputs, use trusted publisher for pypi Fixed dist path Add checkout code back in
- Loading branch information
1 parent
de78cf9
commit bd588d0
Showing
2 changed files
with
50 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,67 @@ | ||
name: Publish to PyPI | ||
name: Publish to TestPyPI and PyPI | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
- "v*.*.*" | ||
|
||
jobs: | ||
publish: | ||
build: | ||
name: Build package | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install build tools | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel setuptools-scm | ||
python -m pip install --upgrade pip setuptools wheel setuptools-scm build | ||
- name: Build package | ||
run: python -m build | ||
run: | | ||
python -m build | ||
- name: Publish to PyPI | ||
- name: Upload package to GitHub artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: python-package-distribution | ||
path: dist/ | ||
|
||
testpypi-publish: | ||
name: Publish to TestPyPI | ||
runs-on: ubuntu-latest | ||
needs: build | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download package from build job | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distribution | ||
path: dist/ | ||
|
||
- name: Publish to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.PYPI_TOKEN }} | ||
repository-url: https://test.pypi.org/legacy/ | ||
|
||
pypi-publish: | ||
name: Publish to PyPI | ||
runs-on: ubuntu-latest | ||
needs: testpypi-publish # Only run after TestPyPI succeeds | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download package from build job | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: python-package-distribution | ||
path: dist/ | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
|
||
|
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