-
Notifications
You must be signed in to change notification settings - Fork 3
234 lines (206 loc) · 8.07 KB
/
release.yml
File metadata and controls
234 lines (206 loc) · 8.07 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
name: Release
on:
workflow_dispatch:
inputs:
release_type:
description: 'Release type'
required: true
default: 'dev'
type: choice
options:
- dev # 0.7.0 -> 0.8.0.dev1, or 0.8.0.dev1 -> 0.8.0.dev2
- stable # 0.8.0.dev2 -> 0.8.0
publish_to:
description: 'Publish to'
required: true
default: 'testpypi'
type: choice
options:
- testpypi
- pypi
permissions:
contents: write
id-token: write
jobs:
# ── Test ────────────────────────────────────────────────────────────
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- name: Run tests
run: |
uv sync
uv run pytest -x -q
- name: Run lint
run: uv run ruff check hexdag/ hexdag_plugins/
# ── Detect changed packages ─────────────────────────────────────────
detect:
needs: test
runs-on: ubuntu-latest
outputs:
hexdag: ${{ steps.check.outputs.hexdag }}
plugins: ${{ steps.check.outputs.plugins }}
studio: ${{ steps.check.outputs.studio }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Detect changed packages
id: check
run: |
CHANGED=$(python scripts/detect_changes.py)
echo "Changed packages: $CHANGED"
echo "hexdag=$(echo $CHANGED | python -c 'import sys,json; print(str("hexdag" in json.load(sys.stdin)).lower())')" >> "$GITHUB_OUTPUT"
echo "plugins=$(echo $CHANGED | python -c 'import sys,json; print(str("hexdag-plugins" in json.load(sys.stdin)).lower())')" >> "$GITHUB_OUTPUT"
echo "studio=$(echo $CHANGED | python -c 'import sys,json; print(str("hexdag-studio" in json.load(sys.stdin)).lower())')" >> "$GITHUB_OUTPUT"
# ── Release hexdag ──────────────────────────────────────────────────
release-hexdag:
needs: detect
if: needs.detect.outputs.hexdag == 'true'
runs-on: ubuntu-latest
environment:
name: ${{ inputs.publish_to }}
url: ${{ inputs.publish_to == 'pypi' && 'https://pypi.org/project/hexdag/' || 'https://test.pypi.org/project/hexdag/' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Release hexdag
uses: ./.github/actions/release-package
with:
pyproject_path: pyproject.toml
release_type: ${{ inputs.release_type }}
publish_to: ${{ inputs.publish_to }}
tag_prefix: v
working_directory: .
test_name: hexDAGtest
package_name: hexdag
- name: Publish to Test PyPI
if: inputs.publish_to == 'testpypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: inputs.publish_to == 'pypi'
uses: pypa/gh-action-pypi-publish@release/v1
# ── Release hexdag-plugins ──────────────────────────────────────────
release-plugins:
needs: [detect, release-hexdag]
if: always() && needs.detect.outputs.plugins == 'true' && (needs.release-hexdag.result == 'success' || needs.release-hexdag.result == 'skipped')
runs-on: ubuntu-latest
environment:
name: ${{ inputs.publish_to }}
url: ${{ inputs.publish_to == 'pypi' && 'https://pypi.org/project/hexdag-plugins/' || 'https://test.pypi.org/project/hexdag-plugins/' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Pull latest changes
run: git pull origin ${{ github.ref_name }}
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Release hexdag-plugins
uses: ./.github/actions/release-package
with:
pyproject_path: hexdag_plugins/pyproject.toml
release_type: ${{ inputs.release_type }}
publish_to: ${{ inputs.publish_to }}
tag_prefix: plugins-v
working_directory: hexdag_plugins
test_name: hexdag-plugins-test
package_name: hexdag-plugins
- name: Publish to Test PyPI
if: inputs.publish_to == 'testpypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: hexdag_plugins/dist/
- name: Publish to PyPI
if: inputs.publish_to == 'pypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: hexdag_plugins/dist/
# ── Release hexdag-studio ───────────────────────────────────────────
release-studio:
needs: [detect, release-plugins]
if: always() && needs.detect.outputs.studio == 'true' && (needs.release-plugins.result == 'success' || needs.release-plugins.result == 'skipped')
runs-on: ubuntu-latest
environment:
name: ${{ inputs.publish_to }}
url: ${{ inputs.publish_to == 'pypi' && 'https://pypi.org/project/hexdag-studio/' || 'https://test.pypi.org/project/hexdag-studio/' }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref_name }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Pull latest changes
run: git pull origin ${{ github.ref_name }}
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Release hexdag-studio
uses: ./.github/actions/release-package
with:
pyproject_path: hexdag-studio/pyproject.toml
release_type: ${{ inputs.release_type }}
publish_to: ${{ inputs.publish_to }}
tag_prefix: studio-v
working_directory: hexdag-studio
test_name: hexdag-studio-test
package_name: hexdag-studio
needs_nodejs: 'true'
nodejs_directory: hexdag-studio/ui
- name: Publish to Test PyPI
if: inputs.publish_to == 'testpypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: hexdag-studio/dist/
- name: Publish to PyPI
if: inputs.publish_to == 'pypi'
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: hexdag-studio/dist/