Skip to content

Commit b1accc7

Browse files
author
Emily Price
authored
Merge pull request #192 from EJEP/add_live_publish_workflow
Add live pypi publish workflow
2 parents 665d747 + bed855d commit b1accc7

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI
2+
on: push
3+
jobs:
4+
build:
5+
name: Build distribution 📦
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
with:
10+
fetch-depth: 0
11+
fetch-tags: true
12+
- name: Set up Python
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.12"
16+
- name: Install hatch
17+
uses: pypa/hatch@install
18+
- name: Build a binary wheel and a source tarball
19+
run: hatch build
20+
- name: Store the distribution packages
21+
uses: actions/upload-artifact@v4
22+
with:
23+
name: python-package-distributions
24+
path: dist/
25+
publish-to-pypi:
26+
name: Publish Python 🐍 distribution 📦 to PyPI
27+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
28+
needs:
29+
- build
30+
runs-on: ubuntu-latest
31+
environment:
32+
name: pypi
33+
url: https://pypi.org/p/datapoint
34+
permissions:
35+
id-token: write # IMPORTANT: mandatory for trusted publishing
36+
steps:
37+
- name: Download all the dists
38+
uses: actions/download-artifact@v4
39+
with:
40+
name: python-package-distributions
41+
path: dist/
42+
- name: Publish distribution 📦 to TestPyPI
43+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/publish-to-test-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
1+
name: Publish Python 🐍 distribution 📦 to TestPyPI
22
on: push
33
jobs:
44
build:

0 commit comments

Comments
 (0)