Repository navigation
84 lines (67 loc) · 2.08 KB
/
Copy pathrelease.yaml
File metadata and controls
84 lines (67 loc) · 2.08 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
name: Release
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
tag:
description: "Release tag, e.g. v25.1 or 25.1"
required: true
type: string
permissions:
contents: write
jobs:
release:
name: Build and release
runs-on: ubuntu-latest
steps:
- name: Resolve tag
id: release
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TAG="${{ inputs.tag }}"
else
TAG="${{ github.ref_name }}"
fi
VERSION="${TAG#v}"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Check out repository
uses: actions/checkout@v5
with:
ref: ${{ steps.release.outputs.tag }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: false
- name: Set up Python
run: uv python install 3.13
- name: Sync dependencies
run: uv sync --all-groups
- name: Check package version matches tag
shell: bash
run: |
PROJECT_VERSION="$(uv run python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
TAG_VERSION="${{ steps.release.outputs.version }}"
echo "pyproject.toml version: $PROJECT_VERSION"
echo "release tag version: $TAG_VERSION"
if [ "$PROJECT_VERSION" != "$TAG_VERSION" ]; then
echo "Version mismatch: pyproject.toml has $PROJECT_VERSION but tag is $TAG_VERSION"
exit 1
fi
- name: Lint
run: uv run ruff check .
- name: Test
run: uv run pytest
- name: Build wheel
run: uv build --wheel
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${{ steps.release.outputs.tag }}" \
--title "${{ steps.release.outputs.tag }}" \
--notes "Release ${{ steps.release.outputs.tag }}" \
dist/*.whl