Skip to content

Commit 70cf409

Browse files
committed
Adding a GitHub Workflow doc to automatically build and post to PyPI
- required entering in the repo location on PyPI itself
1 parent 0cad52a commit 70cf409

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/Publish_FAD.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build and upload to PyPI
2+
3+
# Build on every branch push, tag push, and pull request change:
4+
#on: [push, pull_request]
5+
# Alternatively, to publish when a (published) GitHub Release is created, use the following:
6+
on:
7+
push:
8+
pull_request:
9+
release:
10+
types:
11+
- published
12+
13+
jobs:
14+
build_and_upload_pypi:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
18+
# upload to PyPI on every tag starting with 'v'
19+
#if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
20+
# alternatively, to publish when a GitHub Release is created, use the following rule:
21+
if: github.event_name == 'release' && github.event.action == 'published'
22+
steps:
23+
- name: checkout repository
24+
uses: actions/checkout@v5
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v6
28+
id: cp
29+
with:
30+
python-version: "3.12"
31+
update-environment: true
32+
33+
- name: Install pypa/build
34+
run: |
35+
python -m pip install build
36+
37+
- name: Build a binary wheel and a source tarball
38+
run: |
39+
python -m build .
40+
41+
- name: Upload to PyPI
42+
uses: pypa/gh-action-pypi-publish@release/v1
43+
# with:
44+
# user: __token__
45+
# password: ${{ secrets.pypi_password }}
46+
# To test: repository_url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)