Skip to content

Commit

Permalink
Improve pypi cd pipeline according scientific-python/cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
oshadura committed Dec 7, 2023
1 parent 92cbd0c commit 69d085e
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions .github/workflows/pypi-tag-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Create a tag (on devel) or create release
name: Deploy to PyPI

on:
Expand All @@ -8,33 +7,39 @@ on:
- published

jobs:
deploy:

dist:
name: Distribution build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel twine setuptools setuptools_scm
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- uses: hynek/build-and-inspect-python-package@v1

- name: Build package
run: |
python -m build --outdir dist/
python -m twine check dist/*
python -m setuptools_scm --strip-dev
publish:
name: Publish
needs: [dist]
environment:
name: pypi
url: https://pypi.org/project/coffea-casa/
permissions:
id-token: write
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: Packages
path: dist

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: startsWith(github.ref, 'refs/tags')
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}

0 comments on commit 69d085e

Please sign in to comment.