Repository navigation
68 lines (57 loc) · 1.88 KB
/
Copy pathrelease.yml
File metadata and controls
68 lines (57 loc) · 1.88 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
58
59
60
61
62
63
64
65
66
67
68
name: release
# Publishes throughline-compose to PyPI when a GitHub Release is published.
#
# Uses PyPI Trusted Publishing (OIDC) — no API token is stored as a secret. Before
# the first release, register this repository + workflow as a trusted publisher for
# the `throughline-compose` project on PyPI
# (https://pypi.org/manage/account/publishing/) and create a GitHub Environment named
# `pypi`. Until then this workflow is dormant (it only runs on a published Release,
# and there is nothing to publish before then).
on:
release:
types: [published]
permissions:
contents: read
jobs:
# The shipped suite, run from the shipped artifact, BEFORE anything is uploaded
# (SR-0028). A check that runs after the upload names a defect the reader can no
# longer avoid, so publication waits on this rather than reporting beside it.
sdist-suite:
uses: ./.github/workflows/sdist-suite.yml
build:
name: Build sdist + wheel
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Build
run: |
python -m pip install --upgrade build
python -m build
- name: Check metadata
run: |
python -m pip install --upgrade twine
python -m twine check dist/*
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
publish:
name: Publish to PyPI
needs: [build, sdist-suite]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/throughline-compose
permissions:
id-token: write # required for OIDC trusted publishing
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1