Repository navigation
96 lines (77 loc) · 2.33 KB
/
Copy pathrelease.yml
File metadata and controls
96 lines (77 loc) · 2.33 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Release
on:
push:
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
test:
uses: ./.github/workflows/test.yml
build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.12
- name: Verify version consistency
run: |
uv run python - <<'PY'
import os
import tomllib
with open("pyproject.toml", "rb") as f:
pyproject_version = tomllib.load(f)["project"]["version"]
with open("uv.lock", "rb") as f:
lock = tomllib.load(f)
lock_version = next(
package["version"]
for package in lock["package"]
if package["name"] == "ytstudio-cli"
)
tag = os.environ["GITHUB_REF"]
expected_tag = f"refs/tags/v{pyproject_version}"
if lock_version != pyproject_version:
raise SystemExit(
f"uv.lock version {lock_version} does not match "
f"pyproject.toml version {pyproject_version}"
)
if tag != expected_tag:
raise SystemExit(f"tag {tag} does not match package version {expected_tag}")
PY
- name: Build package
run: uv build
- name: Smoke test wheel
run: |
uv venv /tmp/ytstudio-smoke
uv pip install --python /tmp/ytstudio-smoke/bin/python dist/*.whl
/tmp/ytstudio-smoke/bin/ytstudio --version
/tmp/ytstudio-smoke/bin/yts --version
/tmp/ytstudio-smoke/bin/ytstudio --help
/tmp/ytstudio-smoke/bin/ytstudio videos --help
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish:
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- name: Download dist artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1