-
Notifications
You must be signed in to change notification settings - Fork 3
47 lines (45 loc) · 1.11 KB
/
build_and_publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Build and upload to PyPI
on:
pull_request:
push:
branches:
- "main"
tags:
- "v*"
release:
types:
- published
jobs:
build_artifacts:
name: Build artifacts
runs-on: ubuntu-latest
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v4
- name: Set up pixi
uses: prefix-dev/[email protected]
- name: Build
# It seems as though flit publish expects a .pypirc file as compared to
# only a token passed as an argument.
# See https://flit.pypa.io/en/latest/cmdline.html#flit-publish
run: |
pixi run flit build
- uses: actions/upload-artifact@v4
with:
path: dist/*
upload_pypi:
name: Upload to PyPI
needs: [build_artifacts]
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
environment: pypi
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist
- uses: pypa/[email protected]