mirror of
https://github.com/marceloprates/prettymaps.git
synced 2025-01-16 20:48:13 +01:00
ci: Add publishing workflow with GitHub Actions
* Test building a sdist and wheel on push events and pull request events * List contents of sdist and wheel for visual checks / debugging - Note that check-manifest is currently incompatible with `prune **` strategy * Publish sdists and wheels to TestPyPI through pushed tags triggered through push events * Publish sdists and wheels to PyPI through published release events triggered through GitHub releases
This commit is contained in:
parent
fdf5c28e32
commit
1cbad7db7f
64
.github/workflows/publish-package.yml
vendored
Normal file
64
.github/workflows/publish-package.yml
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
name: publish distributions
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- v*
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
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.9
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.9
|
||||
|
||||
- name: Install build and twine
|
||||
run: |
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
python -m pip install build twine
|
||||
python -m pip list
|
||||
|
||||
- name: Build a sdist and a wheel
|
||||
run: python -m build --outdir dist/ .
|
||||
|
||||
- name: Verify the distribution
|
||||
run: twine check dist/*
|
||||
|
||||
- name: List contents of sdist
|
||||
run: python -m tarfile --list dist/prettymaps-*.tar.gz
|
||||
|
||||
- name: List contents of wheel
|
||||
run: python -m zipfile --list dist/prettymaps-*.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 == 'marceloprates/prettymaps'
|
||||
uses: pypa/gh-action-pypi-publish@v1.4.2
|
||||
with:
|
||||
password: ${{ secrets.test_pypi_password }}
|
||||
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 == 'marceloprates/prettymaps'
|
||||
uses: pypa/gh-action-pypi-publish@v1.4.2
|
||||
with:
|
||||
password: ${{ secrets.pypi_password }}
|
Loading…
x
Reference in New Issue
Block a user