generated from aicoe-aiops/project-template
-
Notifications
You must be signed in to change notification settings - Fork 41
63 lines (53 loc) · 1.55 KB
/
release.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
---
name: "🐍📦 Production build and release"
# GitHub/PyPI trusted publisher documentation:
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# yamllint disable-line rule:truthy
on:
workflow_dispatch:
push:
# Only invoked on release tag pushes
tags:
- v*.*.*
env:
python-version: "3.9"
jobs:
publish:
name: "🐍📦 Build and publish"
runs-on: ubuntu-latest
environment:
name: pypi
permissions:
# IMPORTANT: mandatory for trusted publishing
id-token: write
steps:
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Setup PDM for build commands"
uses: pdm-project/setup-pdm@v4
with:
version: 2.10.0
- name: "Setup Python"
uses: actions/[email protected]
with:
python-version: ${{ env.python-version }}
- name: "Build with PDM backend"
run: |
pdm build
- name: "Sign packages with Sigstore"
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: "Remove files unsupported by PyPi"
run: |
if [ -f dist/buildvars.txt ]; then
rm dist/buildvars.txt
fi
rm dist/*.sigstore* | true
- name: "Publish package to PyPI"
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
password: ${{ secrets.PYPI_API_TOKEN }}