Skip to content

Commit d3577cb

Browse files
committed
Add a publish workflow for GitHub Actions
1 parent c4e03f4 commit d3577cb

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

.github/workflows/publish.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish to PyPi
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
name: Build distribution 📦
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.x"
19+
- name: Install pypa/build
20+
run: >-
21+
python3 -m
22+
pip install
23+
build
24+
--user
25+
- name: Build a binary wheel and a source tarball
26+
run: python3 -m build
27+
- name: Store the distribution packages
28+
uses: actions/upload-artifact@v4
29+
with:
30+
name: python-package-distributions
31+
path: dist/*
32+
33+
publish-to-pypi:
34+
name: >-
35+
Publish Python 🐍 distribution 📦 to PyPI
36+
and Sign with Sigstore
37+
if: startsWith(github.ref, 'refs/tags/')
38+
needs:
39+
- build
40+
runs-on: ubuntu-latest
41+
environment:
42+
name: pypi
43+
url: https://pypi.org/p/eppo-metrics-sync/
44+
permissions:
45+
id-token: write
46+
contents: write
47+
48+
steps:
49+
- name: Download all the dists
50+
uses: actions/download-artifact@v4
51+
with:
52+
name: python-package-distributions
53+
path: dist/
54+
- name: Publish distribution 📦 to PyPI
55+
uses: pypa/gh-action-pypi-publish@release/v1
56+
- name: Sign the dists with Sigstore
57+
uses: sigstore/[email protected]
58+
with:
59+
inputs: >-
60+
./dist/*.tar.gz
61+
./dist/*.whl

0 commit comments

Comments
 (0)