-
Notifications
You must be signed in to change notification settings - Fork 5
99 lines (86 loc) · 3.09 KB
/
Copy pathrelease.yml
File metadata and controls
99 lines (86 loc) · 3.09 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
97
98
99
name: Release
# Publishes codeframe-ai to PyPI and creates a GitHub Release when a version
# tag (vX.Y.Z) is pushed. Uses PyPI Trusted Publishing (OIDC) — no API tokens.
#
# One-time setup required on PyPI before the first tag:
# pypi.org -> project "codeframe-ai" -> Publishing -> add a Trusted Publisher
# with owner=frankbria, repo=codeframe, workflow=release.yml, environment=pypi.
# Until that pending publisher exists, the publish-pypi job will fail by design.
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: Build sdist + wheel
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Set up uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
python-version: "3.11"
- name: Verify tag matches package version
if: startsWith(github.ref, 'refs/tags/v')
run: |
TAG="${GITHUB_REF_NAME#v}"
VER="$(grep -m1 '^version = ' pyproject.toml | sed 's/.*"\(.*\)".*/\1/')"
echo "tag=$TAG pyproject=$VER"
if [ "$TAG" != "$VER" ]; then
echo "::error::Tag v$TAG does not match pyproject version $VER"
exit 1
fi
- name: Build
run: uv build
- name: Smoke-test the built wheel installs a working cf
run: |
uv venv /tmp/verify
uv pip install --python /tmp/verify dist/*.whl
/tmp/verify/bin/cf --help
- name: Upload distributions
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: dist
path: dist/
if-no-files-found: error
publish-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/p/codeframe-ai
permissions:
id-token: write # required for Trusted Publishing
steps:
- name: Download distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1
github-release:
name: GitHub Release
needs: publish-pypi
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download distributions
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: dist
path: dist/
- name: Create GitHub Release
uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2
with:
files: dist/*
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}