-
Notifications
You must be signed in to change notification settings - Fork 22
253 lines (205 loc) · 7.06 KB
/
Copy pathrelease.yml
File metadata and controls
253 lines (205 loc) · 7.06 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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
name: Release
env:
UV_PYTHON: "3.13"
on:
push:
tags:
- "pypi-glasskit-ai-v*"
- "npm-glasskit-ai-create-v*"
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release-pypi:
name: Test, build, publish
if: startsWith(github.ref_name, 'pypi-glasskit-ai-v')
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/glasskit.ai
permissions:
contents: write
id-token: write
defaults:
run:
working-directory: cli
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
with:
enable-cache: true
cache-dependency-glob: uv.lock
working-directory: cli
- name: Install Python
run: uv python install 3.13
- name: Sync dependencies
run: uv sync --locked --dev
- name: Verify Python runtime
run: uv run python -c "import sys; assert sys.version_info[:2] == (3, 13), sys.version"
- name: Verify tag matches package version
shell: bash
run: |
PACKAGE_VERSION="$(uv version --short)"
TAG_VERSION="${GITHUB_REF_NAME#pypi-glasskit-ai-v}"
if [[ "${PACKAGE_VERSION}" != "${TAG_VERSION}" ]]; then
echo "::error::pyproject.toml version ${PACKAGE_VERSION} does not match tag ${TAG_VERSION}"
exit 1
fi
- name: Type check
run: uv run ty check
- name: Run tests
run: uv run pytest
- name: Lint
run: uv run ruff check
- name: Check formatting
run: uv run ruff format --check
- name: Smoke test CLI help
run: |
uv run glasskit --help
uv run glasskit eval --help
- name: Build distributions
run: uv build --no-sources --clear
- name: Smoke test wheel
run: uv run --isolated --no-project --with dist/*.whl glasskit --help
- name: Smoke test source distribution
run: uv run --isolated --no-project --with dist/*.tar.gz glasskit --help
- name: Publish to PyPI
run: uv publish --trusted-publishing always
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG_PREFIX: pypi-glasskit-ai-v
run: |
VERSION="${GITHUB_REF_NAME#${RELEASE_TAG_PREFIX}}"
PREVIOUS_TAG="$(
git tag --list "${RELEASE_TAG_PREFIX}*" --sort=-v:refname \
| grep -Fxv "${GITHUB_REF_NAME}" \
| head -n 1 \
|| true
)"
{
echo "PyPI package: glasskit.ai"
echo "Version: ${VERSION}"
if [[ -n "${PREVIOUS_TAG}" ]]; then
echo
echo "CLI changes since ${PREVIOUS_TAG}:"
git log --format='- %s (%h)' "${PREVIOUS_TAG}..${GITHUB_REF_NAME}" -- . > /tmp/cli-release-changes.txt
if [[ -s /tmp/cli-release-changes.txt ]]; then
cat /tmp/cli-release-changes.txt
else
echo "- No changes under cli/."
fi
else
echo
echo "Initial PyPI release for glasskit.ai."
fi
} > release-notes.md
gh release create "${GITHUB_REF_NAME}" dist/* \
--repo "${GITHUB_REPOSITORY}" \
--verify-tag \
--title "PyPI: glasskit.ai v${VERSION}" \
--notes-file release-notes.md
release-npm:
name: Test, pack, publish
if: startsWith(github.ref_name, 'npm-glasskit-ai-create-v')
runs-on: ubuntu-latest
environment:
name: npm
url: https://www.npmjs.com/package/@glasskit.ai/create
permissions:
contents: write
id-token: write
defaults:
run:
working-directory: js
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
registry-url: "https://registry.npmjs.org"
package-manager-cache: false
- name: Show versions
run: |
node --version
npm --version
- name: Install dependencies
run: npm ci
- name: Verify tag matches package version
shell: bash
run: |
PACKAGE_VERSION="$(node -p "require('./package.json').version")"
TAG_VERSION="${GITHUB_REF_NAME#npm-glasskit-ai-create-v}"
if [[ "${PACKAGE_VERSION}" != "${TAG_VERSION}" ]]; then
echo "::error::package.json version ${PACKAGE_VERSION} does not match tag ${TAG_VERSION}"
exit 1
fi
- name: Run tests
run: npm test
- name: Pack package
shell: bash
run: |
mkdir -p /tmp/npm-package
npm pack --pack-destination /tmp/npm-package
ls -la /tmp/npm-package
- name: Smoke test packed package
shell: bash
run: |
TARBALL="$(ls /tmp/npm-package/*.tgz)"
TMP="$(mktemp -d)"
OUT="$(mktemp -d)"
npm install --prefix "${TMP}" "${TARBALL}"
"${TMP}/node_modules/.bin/create-glasskit" --help
"${TMP}/node_modules/.bin/create-glasskit" --version
(
cd "${OUT}"
"${TMP}/node_modules/.bin/create-glasskit"
)
test -f "${OUT}/rokid-starter/AGENTS.md"
test -f "${OUT}/rokid-starter/.gitignore"
test ! -e "${OUT}/rokid-starter/gitignore"
test -f "${OUT}/rokid-starter/gradle/wrapper/gradle-wrapper.jar"
- name: Publish to npm
run: npm publish --access public
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG_PREFIX: npm-glasskit-ai-create-v
run: |
VERSION="${GITHUB_REF_NAME#${RELEASE_TAG_PREFIX}}"
PREVIOUS_TAG="$(
git tag --list "${RELEASE_TAG_PREFIX}*" --sort=-v:refname \
| grep -Fxv "${GITHUB_REF_NAME}" \
| head -n 1 \
|| true
)"
{
echo "npm package: @glasskit.ai/create"
echo "Version: ${VERSION}"
if [[ -n "${PREVIOUS_TAG}" ]]; then
echo
echo "JS create package changes since ${PREVIOUS_TAG}:"
git log --format='- %s (%h)' "${PREVIOUS_TAG}..${GITHUB_REF_NAME}" -- . > /tmp/npm-release-changes.txt
if [[ -s /tmp/npm-release-changes.txt ]]; then
cat /tmp/npm-release-changes.txt
else
echo "- No changes under js/."
fi
else
echo
echo "Initial npm release for @glasskit.ai/create."
fi
} > release-notes.md
gh release create "${GITHUB_REF_NAME}" /tmp/npm-package/*.tgz \
--repo "${GITHUB_REPOSITORY}" \
--verify-tag \
--title "npm: @glasskit.ai/create v${VERSION}" \
--notes-file release-notes.md