Skip to content

Commit c653e39

Browse files
[CI] Adds publishing workflow
1 parent c8677a8 commit c653e39

1 file changed

Lines changed: 76 additions & 0 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: publish_tag_pypi
2+
3+
on:
4+
workflow_run:
5+
workflows: ["dev_test_project"]
6+
types: [completed]
7+
8+
env:
9+
OUTPUT_DIRECTORY: "/tmp/wheelhouse"
10+
11+
jobs:
12+
build-wheels:
13+
name: Build wheels for ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, ubuntu-22.04-arm, windows-latest, windows-11-arm, macos-12, macos-14]
20+
21+
if: >
22+
github.event.workflow_run.conclusion == "success"
23+
&& startsWith(github.ref, 'refs/tags/v')
24+
steps:
25+
- uses: actions/checkout@v5
26+
27+
- run: mkdir $OUTPUT_DIRECTORY
28+
29+
- name: Run cibuildwheels
30+
uses: pypa/cibuildwheel@v3.3.1
31+
with:
32+
output-dir: ${{ env.OUTPUT_DIRECTORY }}
33+
34+
- name: Persist files for publish jobs
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: wheels-${{ matrix.os }}
38+
path: ${{ env.OUTPUT_DIRECTORY }}
39+
40+
build-sdist:
41+
name: Build source distribution
42+
runs-on: ubuntu-latest
43+
needs: build-wheels
44+
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- run: mkdir $OUTPUT_DIRECTORY
49+
50+
- name: Build sdist
51+
run: pipx run build --sdist -o $OUTPUT_DIRECTORY
52+
53+
- uses: actions/upload-artifact@v4
54+
with:
55+
name: sdist
56+
path: ${{ env.OUTPUT_DIRECTORY }}
57+
58+
publish:
59+
name: Publish release to Pypi
60+
runs-on: ubuntu-latest
61+
needs: [build-wheels, build-sdist]
62+
permissions:
63+
id-token: write
64+
65+
steps:
66+
- uses: actions/download-artifact@v4
67+
with:
68+
path: dist
69+
merge-multiple: true
70+
71+
- name: Upload to Pypi
72+
uses: pypa/gh-action-pypi-publish@release/v1
73+
74+
# Temporary argument to test uploads to TestPyPI
75+
with:
76+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)