-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (59 loc) · 1.67 KB
/
publish.yml
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Release
on:
release:
types: [ published ]
workflow_dispatch:
inputs:
upload:
description: 'Upload release to PyPI'
required: false
type: boolean
default: false
permissions:
contents: read
jobs:
release-build:
name: Build the release
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
attestations: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup and Cache Python Poetry
uses: packetcoders/[email protected]
with:
python-version: "3.12"
poetry-version: "1.8.4"
- name: Package project
run: poetry build
- name: Sign build artifacts
uses: actions/attest-build-provenance@v1
with:
subject-path: "dist/*"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: release-dists
retention-days: 1
path: "dist/"
pypi-publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: release-build
if: ${{ (github.event.inputs.upload || github.event.action == 'published') && github.event.release.draft == false }}
permissions:
contents: read
id-token: write
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true