-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (53 loc) · 1.59 KB
/
Copy pathrelease.yml
File metadata and controls
57 lines (53 loc) · 1.59 KB
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
name: release
on:
push:
tags: ["v*"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
# A tag checkout is clean by construction, so the sdist cannot pick up
# untracked working files the way a laptop build can.
- run: pip install build check-manifest pytest -e .
- run: check-manifest
- run: pytest -q
- run: python -m build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish:
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # mint the OIDC token PyPI trusted publishing verifies
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2
# Actual repository release. Without this the package reaches PyPI while the
# repository still shows the previous version as latest.
github-release:
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # the annotation lives on the tag object, not the commit
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- run: gh release create "$GITHUB_REF_NAME" dist/* --title "$GITHUB_REF_NAME" --notes-from-tag
env:
GH_TOKEN: ${{ github.token }}