Skip to content

Commit 0e6b18d

Browse files
authored
ci: restore everything except Sigstore Action bump
1 parent 261d1ef commit 0e6b18d

File tree

1 file changed

+54
-4
lines changed

1 file changed

+54
-4
lines changed

.github/workflows/publish.yml

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Publish Python distribution to PyPI and TestPyPI
22

3-
on: pull_request
3+
on: push
44

55
jobs:
66
build:
@@ -9,6 +9,9 @@ jobs:
99

1010
steps:
1111
- uses: actions/checkout@v4
12+
- name: Add unique post-release segment to publish to TestPyPI
13+
if: "!startsWith(github.ref, 'refs/tags/')" # only modify version when publishing to TestPyPI
14+
run: sed -i "s/^\(__version__ = \"[0-9]\+\.[0-9]\+\.[0-9]\+\)\"$/\1.post$(date +%s)\"/" ibis_ml/__init__.py
1215
- name: Set up Python
1316
uses: actions/setup-python@v4
1417
with:
@@ -23,10 +26,33 @@ jobs:
2326
name: python-package-distributions
2427
path: dist/
2528

29+
publish-to-pypi:
30+
name: Publish Python distribution to PyPI
31+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
32+
needs:
33+
- build
34+
runs-on: ubuntu-latest
35+
36+
environment:
37+
name: pypi
38+
url: https://pypi.org/p/ibis-ml
39+
40+
permissions:
41+
id-token: write # IMPORTANT: mandatory for trusted publishing
42+
43+
steps:
44+
- name: Download all the dists
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: python-package-distributions
48+
path: dist/
49+
- name: Publish distribution to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1
51+
2652
github-release:
2753
name: Sign the Python distribution with Sigstore and upload them to GitHub Release
2854
needs:
29-
- build
55+
- publish-to-pypi
3056
runs-on: ubuntu-latest
3157

3258
permissions:
@@ -48,11 +74,35 @@ jobs:
4874
- name: Create GitHub Release
4975
env:
5076
GITHUB_TOKEN: ${{ github.token }}
51-
run: gh release create 'v0.1.4' --repo '${{ github.repository }}' --notes ""
77+
run: gh release create '${{ github.ref_name }}' --repo '${{ github.repository }}' --notes ""
5278
- name: Upload artifact signatures to GitHub Release
5379
env:
5480
GITHUB_TOKEN: ${{ github.token }}
5581
# Upload to GitHub Release using the `gh` CLI.
5682
# `dist/` contains the built packages, and the
5783
# sigstore-produced signatures and certificates.
58-
run: gh release upload 'v0.1.4' dist/** --repo '${{ github.repository }}'
84+
run: gh release upload '${{ github.ref_name }}' dist/** --repo '${{ github.repository }}'
85+
86+
publish-to-testpypi:
87+
name: Publish Python distribution to TestPyPI
88+
needs:
89+
- build
90+
runs-on: ubuntu-latest
91+
92+
environment:
93+
name: testpypi
94+
url: https://test.pypi.org/p/ibis-ml
95+
96+
permissions:
97+
id-token: write # IMPORTANT: mandatory for trusted publishing
98+
99+
steps:
100+
- name: Download all the dists
101+
uses: actions/download-artifact@v4
102+
with:
103+
name: python-package-distributions
104+
path: dist/
105+
- name: Publish distribution to TestPyPI
106+
uses: pypa/gh-action-pypi-publish@release/v1
107+
with:
108+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)