Skip to content

Commit 8b5cb2f

Browse files
Merge pull request #2 from joaopedrosvr97-hub/ci/pypi-publish
Add GitHub Actions workflow for PyPI publishing
2 parents a2d6073 + 36148aa commit 8b5cb2f

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CI + Publish to PyPI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- "v*"
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout repo
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install build backend
24+
run: pip install build
25+
26+
- name: Build package
27+
run: python -m build
28+
29+
- name: Upload build artifact
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: dist-files
33+
path: dist/
34+
35+
publish:
36+
needs: build
37+
runs-on: ubuntu-latest
38+
if: startsWith(github.ref, 'refs/tags/v')
39+
40+
steps:
41+
- name: Download build artifacts
42+
uses: actions/download-artifact@v4
43+
with:
44+
name: dist-files
45+
path: dist/
46+
47+
- name: Publish to PyPI
48+
uses: pypa/gh-action-pypi-publish@release/v1
49+
with:
50+
password: ${{ secrets.PYPI_API_TOKEN }}
51+
skip_existing: true

0 commit comments

Comments
 (0)