Skip to content

Commit 477c444

Browse files
Do PyPI release in GitHub Actions (#155)
This workflow is based on https://learn.scientific-python.org/development/guides/gha-pure/ This introduces GitHub Actions (GHA), alongside CircleCI. An additional integration is not ideal, but this gets us some community-supported tooling and more secure handshaking between GitHub and PyPI for publishing via "Trusted Publisher" so we don't need to manage secrets: https://docs.pypi.org/trusted-publishers/ Co-authored-by: Rob Brackett <[email protected]>
1 parent 4ac0342 commit 477c444

File tree

2 files changed

+38
-22
lines changed

2 files changed

+38
-22
lines changed

.circleci/config.yml

-22
Original file line numberDiff line numberDiff line change
@@ -101,27 +101,6 @@ jobs:
101101
. ~/venv/bin/activate
102102
flake8 .
103103
104-
build:
105-
working_directory: ~/wayback
106-
docker:
107-
- image: cimg/python:3.12
108-
steps:
109-
- checkout
110-
- setup_pip:
111-
python-version: "3.12"
112-
install-dev: true
113-
- run:
114-
name: Build Distribution
115-
command: |
116-
. ~/venv/bin/activate
117-
python -m build .
118-
- run:
119-
name: Check Distribution
120-
command: |
121-
. ~/venv/bin/activate
122-
twine check dist/*
123-
check-wheel-contents dist
124-
125104
# NOTE: The docs are mainly built and published directly by readthedocs.com.
126105
# This job is meant to verify there are no issues with the docs and it is NOT
127106
# responsible for building what actually gets published. (Readthedocs.com
@@ -151,5 +130,4 @@ workflows:
151130
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
152131
urllib3-version: ["1.20", "2.0"]
153132
- lint
154-
- build
155133
- docs

.github/workflows/cd.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: CD
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request: {}
6+
push:
7+
branches:
8+
- main
9+
release:
10+
types:
11+
- published
12+
13+
jobs:
14+
dist:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- uses: hynek/build-and-inspect-python-package@v2
22+
23+
publish:
24+
needs: [dist]
25+
environment: pypi
26+
permissions:
27+
id-token: write
28+
runs-on: ubuntu-latest
29+
if: github.event_name == 'release' && github.event.action == 'published'
30+
31+
steps:
32+
- uses: actions/download-artifact@v4
33+
with:
34+
name: Packages
35+
path: dist
36+
37+
- uses: pypa/gh-action-pypi-publish@release/v1
38+

0 commit comments

Comments
 (0)