-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 1.8 KB
/
cd.yml
File metadata and controls
77 lines (65 loc) · 1.8 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
name: CD
on:
push:
branches: ["main"]
workflow_dispatch:
inputs:
bump:
description: "Version bump type"
required: true
type: choice
options:
- patch
- minor
- major
jobs:
ci:
uses: ./.github/workflows/ci.yml
release:
needs: ci
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: pypi
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install Python
run: uv python install
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version
id: version
run: |
uv version --bump ${{ inputs.bump || 'patch' }}
VERSION=$(uv version --short)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Commit version bump
run: |
git add pyproject.toml uv.lock
git commit -m "chore: release v${{ steps.version.outputs.version }}"
git push
- name: Create and push tag
run: |
git tag "v${{ steps.version.outputs.version }}"
git push origin "v${{ steps.version.outputs.version }}"
- name: Build
run: uv build
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create "v${{ steps.version.outputs.version }}" dist/* \
--title "v${{ steps.version.outputs.version }}" \
--generate-notes
- name: Publish to PyPI
run: uv publish