-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (57 loc) · 1.91 KB
/
Copy pathrelease.yml
File metadata and controls
63 lines (57 loc) · 1.91 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
name: release
# Publishes tailctl to PyPI via OIDC trusted publishing on a version tag.
# No stored tokens: the job mints a short-lived, workflow-scoped credential from PyPI.
#
# Nothing publishes until the suite passes and the tag matches the packaged
# version. PyPI versions are immutable, so a bad publish burns that number for
# good — the gate is much cheaper than the recovery.
#
# Prerequisite (one-time, human, in the PyPI UI) — already configured:
# PyPI project `tailctl` -> Settings -> Publishing -> Add a trusted publisher:
# Owner: DRYCodeWorks
# Repository: tailctl
# Workflow name: release.yml
# Environment: (leave blank)
#
# Release: bump `__version__` in src/tailctl/__init__.py (pyproject reads it
# from there), commit, then push a matching tag:
# git tag v0.1.2 && git push origin v0.1.2
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.13'
- run: pip install -e '.[dev]'
- run: ruff check src tests
- run: pytest
- name: Verify tag matches package version
run: |
tag="${GITHUB_REF_NAME#v}"
pkg="$(python -c 'import tailctl; print(tailctl.__version__)')"
if [ "$tag" != "$pkg" ]; then
echo "::error::tag v$tag does not match package version $pkg"
exit 1
fi
echo "tag v$tag matches package version $pkg"
pypi:
needs: test
runs-on: ubuntu-latest
permissions:
id-token: write # OIDC: mint the PyPI publish credential
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.13'
- run: python -m pip install --upgrade build
- run: python -m build
- uses: pypa/gh-action-pypi-publish@release/v1