Skip to content

Commit 54c9d33

Browse files
authored
Merge pull request #375 from maxfordham/207-pypa-publish-on-tag
🤖add CI to build publish to pypi on tag. Need to verify it works on next tag.
2 parents 0fad541 + bf6353b commit 54c9d33

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/pypi-publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# NOTE-1: This action builds the py pkg as per a pixi command `pixi run build`
2+
# and publishes it to PyPI. Requires org / repo / action / env setup
3+
# as a trusted publisher.
4+
# NOTE-2: this can be copy and pasted between repos without edit
5+
# provided that the repo name and pypi pkg name are the same
6+
name: Publish to PyPI
7+
8+
on:
9+
push:
10+
tags:
11+
- '*'
12+
- '!rc*' # Exclude release candidates
13+
14+
jobs:
15+
16+
pypi-publish:
17+
name: Upload release to PyPI
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: prefix-dev/setup-pixi@v0.8.10
22+
with:
23+
pixi-version: v0.49.0
24+
cache: true
25+
cache-write: ${{ github.event_name == 'push' && github.ref_name == 'main' }}
26+
- run: pixi run build
27+
- name: Publish package distributions to PyPI
28+
uses: pypa/gh-action-pypi-publish@release/v1
29+
environment:
30+
name: pypi
31+
url: https://pypi.org/p/${{ github.action.repository }}
32+
permissions:
33+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing

0 commit comments

Comments
 (0)