Skip to content

Commit f6b9bd0

Browse files
committed
chore(dev): deploy binary distributions to PyPI
Also slightly updated the CI workflows.
1 parent 0ae17a9 commit f6b9bd0

File tree

2 files changed

+44
-16
lines changed

2 files changed

+44
-16
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55

66
name: Build CI
77

8-
on: [pull_request, push]
8+
on:
9+
pull_request:
10+
branches: [main]
11+
push:
12+
branches: [main]
13+
14+
permissions: {}
915

1016
jobs:
1117
build-and-test:
@@ -16,17 +22,18 @@ jobs:
1622
GITHUB_CONTEXT: ${{ toJson(github) }}
1723
run: echo "$GITHUB_CONTEXT"
1824
- name: Set up Python 3.12
19-
uses: actions/setup-python@v5
25+
uses: actions/setup-python@v6
2026
with:
2127
python-version: "3.12"
2228
- name: Versions
2329
run: |
2430
python3 --version
2531
- name: Checkout Current Repo
26-
uses: actions/checkout@v4
32+
uses: actions/checkout@v6
2733
with:
2834
filter: 'blob:none'
29-
depth: 0
35+
fetch-depth: 0
36+
persist-credentials: false
3037
- name: Install requirements
3138
run: |
3239
sudo apt-get update

.github/workflows/release.yml

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,47 @@ on:
99
release:
1010
types: [published]
1111

12+
permissions: {}
13+
1214
jobs:
13-
upload-pypi:
15+
build:
1416
runs-on: ubuntu-latest
1517
steps:
16-
- uses: actions/checkout@v4
18+
- uses: actions/checkout@v6
1719
with:
1820
filter: 'blob:none'
19-
depth: 0
21+
fetch-depth: 0
22+
persist-credentials: false
23+
- name: Set up Python
24+
uses: actions/setup-python@v6
25+
with:
26+
python-version: '3.12'
27+
- name: Build
28+
run: pipx run build
29+
- name: Check dist metadata
30+
run: pipx run twine check dist/*
31+
- name: Upload build as artifacts
32+
uses: actions/upload-artifact@v5
33+
with:
34+
name: dist
35+
path: dist/*
36+
37+
publish:
38+
if: github.event_name == 'release' && startsWith(github.repository_owner, 'adafruit')
39+
needs: [build]
40+
runs-on: ubuntu-latest
41+
steps:
42+
- name: Download build artifacts
43+
uses: actions/download-artifact@v6
44+
with:
45+
name: dist
46+
path: ./dist
2047
- name: Set up Python
21-
uses: actions/setup-python@v5
48+
uses: actions/setup-python@v6
2249
with:
2350
python-version: '3.12'
24-
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
pip install setuptools wheel twine
28-
- name: Build and publish
51+
- name: Publish to PyPI
2952
env:
3053
TWINE_USERNAME: ${{ secrets.pypi_username }}
3154
TWINE_PASSWORD: ${{ secrets.pypi_password }}
32-
run: |
33-
python setup.py sdist
34-
twine upload dist/*
55+
run: pipx run twine upload dist/*

0 commit comments

Comments
 (0)