-
Notifications
You must be signed in to change notification settings - Fork 0
172 lines (155 loc) · 5.81 KB
/
Copy pathrelease.yml
File metadata and controls
172 lines (155 loc) · 5.81 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
name: Release
# Triggers on a pushed git tag matching `v*` (e.g. `v0.1.0`, `v1.0.0-rc1`).
# Builds the wheel + sdist, attests the build, and publishes to PyPI via
# PyPI's trusted publisher (OIDC) — no long-lived API token in repo secrets.
#
# To use this workflow you must first configure vstack as a trusted
# publisher on PyPI:
# https://docs.pypi.org/trusted-publishers/
#
# Once configured, cutting a release is:
#
# git tag v0.1.0
# git push origin v0.1.0
#
# The workflow does the rest.
on:
push:
tags:
- "v*"
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build wheel + sdist for release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
cache: pip
- name: Verify tag matches pyproject version
id: version
run: |
set -e
TAG="${GITHUB_REF_NAME#v}"
PYPROJECT_VERSION=$(python -c "import tomllib, pathlib; print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])")
echo "Tag version: $TAG"
echo "pyproject version: $PYPROJECT_VERSION"
if [ "$TAG" != "$PYPROJECT_VERSION" ]; then
echo "::error::tag $TAG does not match pyproject.toml version $PYPROJECT_VERSION"
exit 1
fi
echo "version=$TAG" >> "$GITHUB_OUTPUT"
- name: Install build
run: python -m pip install build
- name: Build wheel + sdist
run: python -m build
- name: Smoke-test wheel imports all 34 namespaces + surface modules
run: |
python -m pip install "dist/valanistack-${{ steps.version.outputs.version }}-py3-none-any.whl[mcp,api]"
python -c "
import importlib, vstack
assert vstack.__version__ == '${{ steps.version.outputs.version }}', f'version mismatch: {vstack.__version__}'
for ns in [
# 34 pattern namespaces
'vstack.aar', 'vstack.lencioni', 'vstack.trust_triangle',
'vstack.johari', 'vstack.grpi', 'vstack.bias_stack',
'vstack.psych_safety', 'vstack.thomas_kilmann',
'vstack.feedback_triggers', 'vstack.devils_advocate',
'vstack.lewin', 'vstack.mcallister_trust',
'vstack.social_loafing', 'vstack.debate_pathology',
'vstack.process_gain_loss', 'vstack.smart_goal',
'vstack.mcgregor', 'vstack.group_decision',
'vstack.schein_culture', 'vstack.grant_strengths',
'vstack.plus_delta', 'vstack.robbins_culture',
'vstack.superflocks', 'vstack.yerkes_dodson',
'vstack.org_structure', 'vstack.motivation_traps',
'vstack.glaser_conversation', 'vstack.goleman_ei',
'vstack.sdt_reward', 'vstack.span_of_control',
'vstack.danva_emotion', 'vstack.cognitive_reappraisal',
'vstack.hexaco', 'vstack.vroom_expectancy',
# surface modules added in v0.2.0 / v0.3.0
'vstack.mcp', 'vstack.memory', 'vstack.upgrade', 'vstack.api',
# surface modules added in v0.4.0
'vstack.adapters', 'vstack.learnings', 'vstack.analytics',
# surface modules added in v0.5.0
'vstack.browser', 'vstack.gbrain', 'vstack.benchmarks',
# surface modules added in v0.6.0
'vstack.security', 'vstack.cache', 'vstack.observability',
'vstack.doctor',
# surface modules added in v0.7.0
'vstack.hello',
]:
importlib.import_module(ns)
print('Release smoke test passed')
"
- name: Upload built artifacts
uses: actions/upload-artifact@v4
with:
name: release-dist
path: dist/
retention-days: 30
publish-pypi:
name: Publish to PyPI (trusted publisher)
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/valanistack/${{ needs.build.outputs.version }}/
permissions:
id-token: write
steps:
- name: Download built artifacts
uses: actions/download-artifact@v4
with:
name: release-dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
github-release:
name: Create GitHub Release
needs: [build, publish-pypi]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download built artifacts
uses: actions/download-artifact@v4
with:
name: release-dist
path: dist/
- name: Render release body
id: render
env:
VERSION: ${{ needs.build.outputs.version }}
run: |
python .github/render_release_notes.py \
--template .github/RELEASE_TEMPLATE.md \
--changelog CHANGELOG.md \
--version "$VERSION" \
--output release_body.md
{
echo "body<<RELEASE_EOF"
cat release_body.md
echo "RELEASE_EOF"
} >> "$GITHUB_OUTPUT"
- name: Create GitHub Release with artifacts
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: vstack ${{ needs.build.outputs.version }}
body: ${{ steps.render.outputs.body }}
files: |
dist/valanistack-*.whl
dist/valanistack-*.tar.gz
draft: false
prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') }}