Skip to content

Commit 97636c6

Browse files
committed
Add publishing workflow
1 parent c53a5fd commit 97636c6

3 files changed

Lines changed: 89 additions & 68 deletions

File tree

.github/workflows/on-release-main.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
2+
name: Publish Python 🐍 distribution 📦 to PyPI
3+
4+
on: push
5+
6+
jobs:
7+
build:
8+
name: Build distribution 📦
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
persist-credentials: false
15+
16+
- name: Set up uv
17+
uses: astral-sh/setup-uv@v5
18+
19+
- name: Build package
20+
run: uv build
21+
22+
- name: Store the distribution packages
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: python-package-distributions
26+
path: dist/
27+
28+
publish-to-pypi:
29+
name: Publish Python 🐍 distribution 📦 to PyPI
30+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
31+
needs:
32+
- build
33+
runs-on: ubuntu-latest
34+
environment:
35+
name: pypi
36+
url: https://pypi.org/p/generalagents
37+
permissions:
38+
id-token: write # IMPORTANT: mandatory for trusted publishing
39+
steps:
40+
- name: Download all the dists
41+
uses: actions/download-artifact@v4
42+
with:
43+
name: python-package-distributions
44+
path: dist/
45+
- name: Publish distribution 📦 to PyPI
46+
uses: pypa/gh-action-pypi-publish@release/v1
47+
48+
github-release:
49+
name: >-
50+
Sign the Python 🐍 distribution 📦 with Sigstore
51+
and upload them to GitHub Release
52+
needs:
53+
- publish-to-pypi
54+
runs-on: ubuntu-latest
55+
56+
permissions:
57+
contents: write # IMPORTANT: mandatory for making GitHub Releases
58+
id-token: write # IMPORTANT: mandatory for sigstore
59+
60+
steps:
61+
- name: Download all the dists
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: python-package-distributions
65+
path: dist/
66+
- name: Sign the dists with Sigstore
67+
uses: sigstore/gh-action-sigstore-python@v3.0.0
68+
with:
69+
inputs: >-
70+
./dist/*.tar.gz
71+
./dist/*.whl
72+
- name: Create GitHub Release
73+
env:
74+
GITHUB_TOKEN: ${{ github.token }}
75+
run: >-
76+
gh release create
77+
"$GITHUB_REF_NAME"
78+
--repo "$GITHUB_REPOSITORY"
79+
--notes ""
80+
- name: Upload artifact signatures to GitHub Release
81+
env:
82+
GITHUB_TOKEN: ${{ github.token }}
83+
# Upload to GitHub Release using the `gh` CLI.
84+
# `dist/` contains the built packages, and the
85+
# sigstore-produced signatures and certificates.
86+
run: >-
87+
gh release upload
88+
"$GITHUB_REF_NAME" dist/**
89+
--repo "$GITHUB_REPOSITORY"

.github/workflows/validate-codecov-config.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)