-
Notifications
You must be signed in to change notification settings - Fork 1.9k
255 lines (222 loc) · 11.4 KB
/
build-and-release.yml
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
254
255
name: Build all taipy packages and release them
on:
workflow_dispatch:
inputs:
internal_dep_on_pypi:
description: "Point taipy internal dependencies to Pypi? If false it will point to the github .tar.gz release file"
default: "false"
required: true
release_type:
description: "The type of release to be made (dev or production)"
default: "dev"
required: true
target_version:
description: "The version of the package to be released"
required: true
env:
NODE_OPTIONS: --max-old-space-size=4096
permissions:
contents: write
jobs:
fetch-versions:
runs-on: ubuntu-latest
outputs:
config_VERSION: ${{ steps.version-setup.outputs.config_VERSION }}
core_VERSION: ${{ steps.version-setup.outputs.core_VERSION }}
gui_VERSION: ${{ steps.version-setup.outputs.gui_VERSION }}
rest_VERSION: ${{ steps.version-setup.outputs.rest_VERSION }}
templates_VERSION: ${{ steps.version-setup.outputs.templates_VERSION }}
VERSION: ${{ steps.version-setup.outputs.VERSION }}
NEW_VERSION: ${{ steps.version-setup.outputs.NEW_VERSION }}
steps:
- uses: actions/checkout@v4
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Setup Version
id: version-setup
run: |
python tools/release/setup_version.py ALL ${{ github.event.inputs.release_type }} ${{ github.event.inputs.target_version }} ${{ steps.extract_branch.outputs.branch }} >> $GITHUB_OUTPUT
build-and-release-taipy-packages:
needs: [fetch-versions]
timeout-minutes: 20
runs-on: ubuntu-latest
strategy:
matrix:
package: [config, core, gui, rest, templates]
max-parallel: 1
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{secrets.DEPLOY_KEY}}
- uses: actions/setup-python@v5
with:
python-version: 3.9
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Extract commit hash
shell: bash
run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
id: extract_hash
- name: Set Build Variables
id: set-variables
run: |
if [ "${{ matrix.package }}" == "config" ]; then
echo "package_version=${{needs.fetch-versions.outputs.config_VERSION}}" >> $GITHUB_OUTPUT
echo "package_dir=./taipy/config" >> $GITHUB_OUTPUT
echo "release_name=${{needs.fetch-versions.outputs.config_VERSION}}-config" >> $GITHUB_OUTPUT
echo "tar_path=./dist/${{ github.event.repository.name }}-config-${{needs.fetch-versions.outputs.config_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
elif [ "${{ matrix.package }}" == "core" ]; then
echo "package_version=${{needs.fetch-versions.outputs.core_VERSION}}" >> $GITHUB_OUTPUT
echo "package_dir=./taipy/core" >> $GITHUB_OUTPUT
echo "release_name=${{needs.fetch-versions.outputs.core_VERSION}}-core" >> $GITHUB_OUTPUT
echo "tar_path=./dist/${{ github.event.repository.name }}-core-${{needs.fetch-versions.outputs.core_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
elif [ "${{ matrix.package }}" == "gui" ]; then
echo "package_version=${{needs.fetch-versions.outputs.gui_VERSION}}" >> $GITHUB_OUTPUT
echo "package_dir=./taipy/gui" >> $GITHUB_OUTPUT
echo "release_name=${{needs.fetch-versions.outputs.gui_VERSION}}-gui" >> $GITHUB_OUTPUT
echo "tar_path=./dist/${{ github.event.repository.name }}-gui-${{needs.fetch-versions.outputs.gui_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
elif [ "${{ matrix.package }}" == "rest" ]; then
echo "package_version=${{needs.fetch-versions.outputs.rest_VERSION}}" >> $GITHUB_OUTPUT
echo "package_dir=./taipy/rest" >> $GITHUB_OUTPUT
echo "release_name=${{needs.fetch-versions.outputs.rest_VERSION}}-rest" >> $GITHUB_OUTPUT
echo "tar_path=./dist/${{ github.event.repository.name }}-rest-${{needs.fetch-versions.outputs.rest_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
elif [ "${{ matrix.package }}" == "templates" ]; then
echo "package_version=${{needs.fetch-versions.outputs.templates_VERSION}}" >> $GITHUB_OUTPUT
echo "package_dir=./taipy/templates" >> $GITHUB_OUTPUT
echo "release_name=${{needs.fetch-versions.outputs.templates_VERSION}}-templates" >> $GITHUB_OUTPUT
echo "tar_path=./dist/${{ github.event.repository.name }}-templates-${{needs.fetch-versions.outputs.templates_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
fi
shell: bash
- name: Update setup.requirements.txt
run: |
python tools/release/update_setup_requirements.py taipy-${{ matrix.package }} \
${{needs.fetch-versions.outputs.config_VERSION}} \
${{needs.fetch-versions.outputs.core_VERSION}} \
${{needs.fetch-versions.outputs.gui_VERSION}} \
${{needs.fetch-versions.outputs.rest_VERSION}} \
${{needs.fetch-versions.outputs.templates_VERSION}} \
${{ github.event.inputs.internal_dep_on_pypi }}
- name: Copy tools
run: |
cp -r tools ${{ steps.set-variables.outputs.package_dir }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel pipenv mypy black isort
- name: Install GUI dependencies
if: matrix.package == 'gui'
run: |
pipenv install --dev
- name: Generate GUI pyi file
if: matrix.package == 'gui'
run: |
cp tools/gui/generate_pyi.py pyi_temp.py && pipenv run python pyi_temp.py && rm pyi_temp.py
- name: Build frontends
if: matrix.package == 'gui'
run: |
python tools/frontend/bundle_build.py
- name: Copy files from tools
run: |
cp -r tools/packages/taipy-${{matrix.package}}/. ${{ steps.set-variables.outputs.package_dir }}
- name: Build Package Structure
working-directory: ${{ steps.set-variables.outputs.package_dir }}
run: |
python tools/release/build_package_structure.py ${{ matrix.package }}
- name: Copy Taipy Logger
if: matrix.package == 'config'
run: |
cp -r taipy/logger/. ${{ steps.set-variables.outputs.package_dir }}/taipy/logger
- name: Copy _cli folder
run: |
cp -r taipy/_cli/. ${{ steps.set-variables.outputs.package_dir }}/taipy/_cli
- name: Build package
working-directory: ${{ steps.set-variables.outputs.package_dir }}
run: |
python setup.py build_py && python -m build
for file in ./dist/*; do mv "$file" "${file//_/-}"; done
- name: Create tag and release
working-directory: ${{ steps.set-variables.outputs.package_dir }}
run: |
if [ "${{ github.event.inputs.release_type }}" == "dev" ]; then
gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.set-variables.outputs.release_name }} --notes "Release Draft ${{ steps.set-variables.outputs.release_name }}"
else
gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --title ${{ steps.set-variables.outputs.release_name }} --notes "Release ${{ steps.set-variables.outputs.release_name }}"
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-and-release-taipy:
runs-on: ubuntu-latest
needs: [build-and-release-taipy-packages, fetch-versions ]
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{secrets.DEPLOY_KEY}}
- name: Extract commit hash
shell: bash
run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
id: extract_hash
- name: Set Build Variables
id: set-variables
run: |
echo "package_version=${{needs.fetch-versions.outputs.VERSION}}" >> $GITHUB_OUTPUT
echo "release_name=${{needs.fetch-versions.outputs.VERSION}}" >> $GITHUB_OUTPUT
echo "tar_path=./dist/${{ github.event.repository.name }}-${{needs.fetch-versions.outputs.VERSION}}.tar.gz" >> $GITHUB_OUTPUT
- name: Update setup.requirements.txt
run: |
python tools/release/update_setup_requirements.py taipy \
${{needs.fetch-versions.outputs.config_VERSION}} \
${{needs.fetch-versions.outputs.core_VERSION}} \
${{needs.fetch-versions.outputs.gui_VERSION}} \
${{needs.fetch-versions.outputs.rest_VERSION}} \
${{needs.fetch-versions.outputs.templates_VERSION}} \
${{ github.event.inputs.internal_dep_on_pypi }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build wheel
- name: Backup setup.py
run: |
mv setup.py setup.old.py
- name: Copy files from tools
run: |
cp -r tools/packages/taipy/. .
- name: Build Taipy package
run: |
python setup.py build_py && python -m build
- name: Create tag and release Taipy
run: |
if [ "${{ github.event.inputs.release_type }}" == "dev" ]; then
gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title ${{ steps.set-variables.outputs.release_name }} --notes "Release Draft ${{ steps.set-variables.outputs.release_name }}"
else
gh release create ${{ steps.set-variables.outputs.release_name }} ${{ steps.set-variables.outputs.tar_path }} --target ${{ steps.extract_hash.outputs.HASH }} --title ${{ steps.set-variables.outputs.release_name }} --notes "Release ${{ steps.set-variables.outputs.release_name }}"
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download packages
run: |
gh release download ${{ needs.fetch-versions.outputs.config_VERSION }}-config --skip-existing --dir dist
gh release download ${{ needs.fetch-versions.outputs.core_VERSION }}-core --skip-existing --dir dist
gh release download ${{ needs.fetch-versions.outputs.gui_VERSION }}-gui --skip-existing --dir dist
gh release download ${{ needs.fetch-versions.outputs.rest_VERSION }}-rest --skip-existing --dir dist
gh release download ${{ needs.fetch-versions.outputs.templates_VERSION }}-templates --skip-existing --dir dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Bundle all packages in main release tag
run: |
find dist -type f -print0 | xargs -r0 gh release upload ${{ needs.fetch-versions.outputs.VERSION }} --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: stefanzweifel/git-auto-commit-action@v4
with:
file_pattern: '*/version.json'
commit_message: Update version to ${{ needs.fetch-versions.outputs.NEW_VERSION }}
- name: Reset changes
run: |
git reset --hard HEAD
git clean -fdx