-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from matthewfeickert/ci/add-packaging-ci
ci: Add TestPyPI and PyPI publishing workflow
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: publish distributions | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- v* | ||
pull_request: | ||
branches: | ||
- master | ||
release: | ||
types: [published] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-and-publish: | ||
name: Build and publish Python distro to (Test)PyPI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install build, check-manifest, and twine | ||
run: | | ||
python -m pip install --upgrade pip setuptools wheel | ||
python -m pip install build check-manifest twine | ||
python -m pip list | ||
- name: Check MANIFEST | ||
run: | | ||
check-manifest | ||
- name: Build a sdist and a wheel | ||
run: | | ||
python -m build . | ||
- name: Verify the distribution | ||
run: twine check dist/* | ||
|
||
- name: List contents of sdist | ||
run: python -m tarfile --list dist/adage-*.tar.gz | ||
|
||
- name: List contents of wheel | ||
run: python -m zipfile --list dist/adage-*.whl | ||
|
||
- name: Publish distribution 📦 to Test PyPI | ||
# publish to TestPyPI on tag events | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && github.repository == 'yadage/adage' | ||
uses: pypa/[email protected] | ||
with: | ||
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | ||
repository_url: https://test.pypi.org/legacy/ | ||
|
||
- name: Publish distribution 📦 to PyPI | ||
# publish to PyPI on releases | ||
if: github.event_name == 'release' && github.event.action == 'published' && github.repository == 'yadage/adage' | ||
uses: pypa/[email protected] | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} |