-
Notifications
You must be signed in to change notification settings - Fork 1
108 lines (95 loc) · 2.83 KB
/
release-please.yml
File metadata and controls
108 lines (95 loc) · 2.83 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
100
101
102
103
104
105
106
107
108
name: release-please
run-name: promptfoo-python release by @${{ github.actor }}
concurrency:
group: release-please-${{ github.ref }}
cancel-in-progress: false
on:
push:
branches:
- main
workflow_dispatch:
inputs:
tag:
description: "Release tag to re-publish (e.g. promptfoo-v0.1.3). Use when a release build failed."
required: true
type: string
jobs:
release-please:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ inputs.tag || steps.release.outputs.tag_name }}
steps:
# Only run the bot on push events; skip it for manual re-publish triggers.
- uses: googleapis/release-please-action@v4
id: release
if: github.event_name == 'push'
with:
token: ${{ secrets.GITHUB_TOKEN }}
build:
if: |
inputs.tag != '' ||
needs.release-please.outputs.release_created == 'true'
needs: release-please
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
with:
ref: ${{ needs.release-please.outputs.tag_name }}
- uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Pin Python version
run: uv python pin 3.12
- name: Install dependencies
run: uv sync --extra dev
- name: Run unit tests
run: uv run pytest -m 'not smoke' -q
- name: Build package
run: uv build
- name: Verify package version matches release tag
env:
TAG: ${{ needs.release-please.outputs.tag_name }}
run: |
EXPECTED_VERSION="${TAG#promptfoo-v}"
if ls dist/*-${EXPECTED_VERSION}-*.whl 1> /dev/null 2>&1; then
echo "✓ Package version ${EXPECTED_VERSION} matches release tag ${TAG}"
else
echo "ERROR: Package version mismatch!"
echo "Expected: ${EXPECTED_VERSION} (from tag: ${TAG})"
echo "Built packages:"
ls -la dist/
exit 1
fi
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
publish-pypi:
if: |
inputs.tag != '' ||
needs.release-please.outputs.release_created == 'true'
needs: [build, release-please]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/promptfoo/
permissions:
contents: read
id-token: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true