Skip to content

Commit 7d56e1e

Browse files
authored
Merge branch 'develop' into fix/protect-event-processing-in-core-gui-context
2 parents 4ee3519 + 205c728 commit 7d56e1e

File tree

95 files changed

+2228
-1217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+2228
-1217
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,183 +1,217 @@
1-
name: Build and release one taipy sub-package
1+
name: Build one taipy sub-package release
22

33
on:
44
workflow_dispatch:
55
inputs:
6-
internal_dep_on_pypi:
7-
description: "Point taipy internal dependencies to Pypi? If false it will point to the github .tar.gz release file"
8-
default: "false"
9-
required: true
10-
release_type:
11-
description: "The type of release to be made (dev or production)"
12-
default: "dev"
6+
target_package:
7+
description: "Package name"
138
required: true
9+
type: choice
10+
options:
11+
- gui
12+
- common
13+
- core
14+
- rest
15+
- templates
16+
- taipy
1417
target_version:
15-
description: "The version of the package to be released"
18+
description: "Package version"
1619
required: true
17-
target_package:
18-
description: "The package to be released (gui, common, core, rest, templates, taipy)"
20+
release_type:
21+
description: "Release type"
1922
required: true
23+
type: choice
24+
options:
25+
- dev
26+
- production
27+
default: "dev"
28+
sub_packages_location:
29+
description: "Dependencies location"
30+
required: true
31+
type: choice
32+
options:
33+
- GitHub
34+
- Pypi
35+
default: "GitHub"
2036

2137
env:
2238
NODE_OPTIONS: --max-old-space-size=4096
2339

2440
permissions:
2541
contents: write
42+
pull-requests: write
2643

2744
jobs:
28-
fetch-versions:
45+
setup-versions:
2946
runs-on: ubuntu-latest
3047
outputs:
48+
branch: ${{ steps.version-setup.outputs.branch }}
3149
common_VERSION: ${{ steps.version-setup.outputs.common_VERSION }}
3250
core_VERSION: ${{ steps.version-setup.outputs.core_VERSION }}
3351
gui_VERSION: ${{ steps.version-setup.outputs.gui_VERSION }}
3452
rest_VERSION: ${{ steps.version-setup.outputs.rest_VERSION }}
3553
templates_VERSION: ${{ steps.version-setup.outputs.templates_VERSION }}
3654
taipy_VERSION: ${{ steps.version-setup.outputs.taipy_VERSION }}
55+
LATEST_TAIPY_VERSION: ${{ steps.version-setup.outputs.LATEST_TAIPY_VERSION }}
3756
steps:
3857
- uses: actions/checkout@v4
39-
- name: Extract branch name
40-
shell: bash
41-
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
42-
id: extract_branch
4358

44-
- name: Setup Version
59+
- name: Validate target version
60+
run: |
61+
version="${{ github.event.inputs.target_version }}"
62+
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
63+
echo "❌ Invalid version format: '$version' - <M>.<m>.<patch> is mandatory."
64+
exit 1
65+
fi
66+
echo "✅ Valid target version: $version"
67+
68+
- name: Install mandatory Python packages
69+
run: |
70+
python -m pip install --upgrade pip
71+
pip install requests
72+
73+
- name: Setup versions
4574
id: version-setup
4675
run: |
47-
python tools/release/fetch_latest_versions.py \
48-
${{ github.event.inputs.release_type }} \
49-
${{ github.event.inputs.internal_dep_on_pypi }} \
50-
${{ github.event.inputs.target_version }} \
51-
${{ github.event.inputs.target_package }} >> $GITHUB_OUTPUT
76+
python tools/release/setup_versions.py \
77+
${{ github.event.inputs.target_package }} \
78+
-v ${{ github.event.inputs.target_version }} \
79+
-t ${{ github.event.inputs.release_type }} \
80+
-r ${{ github.repository }} >>$GITHUB_OUTPUT
81+
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >>$GITHUB_OUTPUT
5282
53-
build-and-release-package:
54-
needs: [fetch-versions]
83+
build-package-release:
84+
needs: setup-versions
5585
timeout-minutes: 20
5686
runs-on: ubuntu-latest
5787
steps:
5888
- uses: actions/checkout@v4
59-
with:
60-
ssh-key: ${{secrets.DEPLOY_KEY}}
6189
- uses: actions/setup-python@v5
6290
with:
6391
python-version: 3.9
6492
- uses: actions/setup-node@v4
6593
with:
66-
node-version: '20'
94+
node-version: "20"
6795

6896
- name: Extract commit hash
97+
id: extract_hash
6998
shell: bash
7099
run: echo "HASH=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
71-
id: extract_hash
72100

73-
- name: Set Build Variables
74-
id: set-variables
101+
- name: Install mandatory Python packages
102+
run: |
103+
python -m pip install --upgrade pip
104+
pip install requests
105+
106+
- name: Update setup.requirements.txt
107+
run: |
108+
python tools/release/update_setup_requirements.py ${{ github.event.inputs.target_package }} \
109+
${{ needs.setup-versions.outputs.common_VERSION }} \
110+
${{ needs.setup-versions.outputs.core_VERSION }} \
111+
${{ needs.setup-versions.outputs.gui_VERSION }} \
112+
${{ needs.setup-versions.outputs.rest_VERSION }} \
113+
${{ needs.setup-versions.outputs.templates_VERSION }} \
114+
-deps ${{ github.event.inputs.sub_packages_location }} \
115+
-r ${{ github.repository }}
116+
117+
- name: Set package version for ${{ github.event.inputs.target_package }} ${{ github.event.inputs.target_version }}
118+
id: package-version
119+
shell: bash
75120
run: |
76121
if [ "${{ github.event.inputs.target_package }}" == "common" ]; then
77-
echo "package_version=${{needs.fetch-versions.outputs.common_VERSION}}" >> $GITHUB_OUTPUT
78-
echo "package_dir=./taipy/common" >> $GITHUB_OUTPUT
79-
echo "release_name=${{needs.fetch-versions.outputs.common_VERSION}}-common" >> $GITHUB_OUTPUT
80-
echo "tar_path=./dist/${{ github.event.repository.name }}-common-${{needs.fetch-versions.outputs.common_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
122+
echo "version=${{ needs.setup-versions.outputs.common_VERSION }}" >> $GITHUB_OUTPUT
81123
elif [ "${{ github.event.inputs.target_package }}" == "core" ]; then
82-
echo "package_version=${{needs.fetch-versions.outputs.core_VERSION}}" >> $GITHUB_OUTPUT
83-
echo "package_dir=./taipy/core" >> $GITHUB_OUTPUT
84-
echo "release_name=${{needs.fetch-versions.outputs.core_VERSION}}-core" >> $GITHUB_OUTPUT
85-
echo "tar_path=./dist/${{ github.event.repository.name }}-core-${{needs.fetch-versions.outputs.core_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
124+
echo "version=${{ needs.setup-versions.outputs.core_VERSION }}" >> $GITHUB_OUTPUT
86125
elif [ "${{ github.event.inputs.target_package }}" == "gui" ]; then
87-
echo "package_version=${{needs.fetch-versions.outputs.gui_VERSION}}" >> $GITHUB_OUTPUT
88-
echo "package_dir=./taipy/gui" >> $GITHUB_OUTPUT
89-
echo "release_name=${{needs.fetch-versions.outputs.gui_VERSION}}-gui" >> $GITHUB_OUTPUT
90-
echo "tar_path=./dist/${{ github.event.repository.name }}-gui-${{needs.fetch-versions.outputs.gui_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
126+
echo "version=${{ needs.setup-versions.outputs.gui_VERSION }}" >> $GITHUB_OUTPUT
91127
elif [ "${{ github.event.inputs.target_package }}" == "rest" ]; then
92-
echo "package_version=${{needs.fetch-versions.outputs.rest_VERSION}}" >> $GITHUB_OUTPUT
93-
echo "package_dir=./taipy/rest" >> $GITHUB_OUTPUT
94-
echo "release_name=${{needs.fetch-versions.outputs.rest_VERSION}}-rest" >> $GITHUB_OUTPUT
95-
echo "tar_path=./dist/${{ github.event.repository.name }}-rest-${{needs.fetch-versions.outputs.rest_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
128+
echo "version=${{ needs.setup-versions.outputs.rest_VERSION }}" >> $GITHUB_OUTPUT
96129
elif [ "${{ github.event.inputs.target_package }}" == "templates" ]; then
97-
echo "package_version=${{needs.fetch-versions.outputs.templates_VERSION}}" >> $GITHUB_OUTPUT
98-
echo "package_dir=./taipy/templates" >> $GITHUB_OUTPUT
99-
echo "release_name=${{needs.fetch-versions.outputs.templates_VERSION}}-templates" >> $GITHUB_OUTPUT
100-
echo "tar_path=./dist/${{ github.event.repository.name }}-templates-${{needs.fetch-versions.outputs.templates_VERSION}}.tar.gz" >> $GITHUB_OUTPUT
130+
echo "version=${{ needs.setup-versions.outputs.templates_VERSION }}" >> $GITHUB_OUTPUT
131+
elif [ "${{ github.event.inputs.target_package }}" == "taipy" ]; then
132+
echo "version=${{ needs.setup-versions.outputs.taipy_VERSION }}" >> $GITHUB_OUTPUT
101133
fi
102-
shell: bash
103-
104-
- name: Update setup.requirements.txt
105-
run: |
106-
python tools/release/update_setup_requirements.py taipy-${{ github.event.inputs.target_package }} \
107-
${{needs.fetch-versions.outputs.common_VERSION}} \
108-
${{needs.fetch-versions.outputs.core_VERSION}} \
109-
${{needs.fetch-versions.outputs.gui_VERSION}} \
110-
${{needs.fetch-versions.outputs.rest_VERSION}} \
111-
${{needs.fetch-versions.outputs.templates_VERSION}} \
112-
${{ github.event.inputs.internal_dep_on_pypi }}
113-
114-
- name: Copy tools
115-
run: |
116-
cp -r tools ${{ steps.set-variables.outputs.package_dir }}
117134
118135
- name: Install dependencies
119136
run: |
120137
python -m pip install --upgrade pip
121138
pip install build wheel pipenv mypy black isort
122139
123140
- name: Install GUI dependencies
124-
if: github.event.inputs.target_package == 'gui'
141+
if: ${{ github.event.inputs.target_package == 'gui' || github.event.inputs.target_package == 'taipy' }}
125142
run: |
126143
pipenv install --dev
127144
128145
- name: Generate GUI pyi file
129-
if: github.event.inputs.target_package == 'gui'
146+
if: ${{ github.event.inputs.target_package == 'gui' }}
130147
run: |
131148
pipenv run python tools/gui/generate_pyi.py
132149
133-
- name: Build frontends
134-
if: github.event.inputs.target_package == 'gui'
150+
- name: Build Taipy GUI front-end
151+
if: ${{ github.event.inputs.target_package == 'gui' || github.event.inputs.target_package == 'taipy' }}
135152
run: |
136-
python tools/frontend/bundle_build.py
153+
python tools/frontend/bundle_build.py gui
137154
138-
- name: Copy files from tools
155+
- name: Build Taipy front-end
156+
if: ${{ github.event.inputs.target_package == 'taipy' }}
139157
run: |
140-
cp -r tools/packages/taipy-${{ github.event.inputs.target_package }}/. ${{ steps.set-variables.outputs.package_dir }}
158+
python tools/frontend/bundle_build.py taipy
141159
142160
- name: Build Package Structure
143-
working-directory: ${{ steps.set-variables.outputs.package_dir }}
144161
run: |
145-
python tools/release/build_package_structure.py ${{ github.event.inputs.target_package }}
146-
147-
- name: Copy Taipy Logger
148-
if: github.event.inputs.target_package == 'common'
149-
run: |
150-
cp -r taipy/logger/. ${{ steps.set-variables.outputs.package_dir }}/taipy/logger
151-
152-
- name: Copy _cli folder
153-
run: |
154-
cp -r taipy/_cli/. ${{ steps.set-variables.outputs.package_dir }}/taipy/_cli
162+
python tools/release/build_package_structure.py ${{ github.event.inputs.target_package }} ${{ steps.package-version.outputs.version }}
155163
156164
- name: Build package
157-
working-directory: ${{ steps.set-variables.outputs.package_dir }}
165+
working-directory: "build_${{ github.event.inputs.target_package }}"
158166
run: |
159167
python -m build
160-
161-
- name: Rename files
162-
working-directory: ${{ steps.set-variables.outputs.package_dir }}
163-
run: |
164-
for file in ./dist/*; do mv "$file" "${file//_/-}"; done
165-
168+
if compgen -G "./dist/*_*" > /dev/null; then
169+
for file in ./dist/*_*; do mv "$file" "${file//_/-}"; done
170+
fi
171+
166172
- name: Create tag and release
167-
working-directory: ${{ steps.set-variables.outputs.package_dir }}
173+
working-directory: "build_${{ github.event.inputs.target_package }}"
168174
run: |
169-
if [ "${{ github.event.inputs.release_type }}" == "dev" ]; then
170-
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 }}"
171-
else
172-
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 }}"
173-
fi
175+
package_suffix=""
176+
if [ "${{ github.event.inputs.target_package }}" != "taipy" ]; then
177+
package_suffix="-${{ github.event.inputs.target_package }}"
178+
fi
179+
release_name="${{ steps.package-version.outputs.version }}$package_suffix"
180+
tar_path="./dist/taipy$package_suffix-${{ steps.package-version.outputs.version }}.tar.gz"
181+
if [ "${{ github.event.inputs.release_type }}" == "dev" ]; then
182+
gh release create $release_name $tar_path --target ${{ steps.extract_hash.outputs.HASH }} --prerelease --title $release_name --notes "Dev Release $release_name"
183+
else
184+
gh release create $release_name $tar_path --target ${{ steps.extract_hash.outputs.HASH }} --title $release_name --notes "Release $release_name"
185+
fi
174186
shell: bash
175187
env:
176188
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
177189

178-
- name: Ensure Taipy release is marked as latest
190+
- name: Bump patch version
191+
if: ${{ github.event.inputs.release_type == 'production' }}
179192
run: |
180-
gh release edit ${{needs.fetch-versions.outputs.taipy_VERSION}} --latest
193+
python tools/release/bump_patch_version.py ${{ github.event.inputs.target_package }}
194+
195+
- uses: stefanzweifel/git-auto-commit-action@v5
196+
if: ${{ github.event.inputs.release_type == 'production' }}
197+
with:
198+
branch: "devops/bump-patch-version-for-${{ github.event.inputs.target_package }}-${{ github.run_id }}"
199+
create_branch: "true"
200+
file_pattern: "**/version.json"
201+
commit_message: Bump patch versions for ${{ github.event.inputs.target_package }}
202+
203+
- name: Create pull request
204+
if: ${{ github.event.inputs.release_type == 'production' }}
205+
run: gh pr create -B "${{ needs.setup-versions.outputs.branch }}" -H "devops/bump-patch-version-for-${{ github.event.inputs.target_package }}-${{ github.run_id }}" --title "Bump patch version" --body "Created by GitHub action build-and-release-single-package"
206+
env:
207+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
208+
209+
# Ensure the latest 'taipy' production release, if there is one, is marked as *latest* no matter what
210+
- name: Force latest 'taipy' production release
211+
run: |
212+
if [ "${{ needs.setup-versions.outputs.LATEST_TAIPY_VERSION }}" != "0.0.0" ]; then
213+
gh release edit ${{ needs.setup-versions.outputs.LATEST_TAIPY_VERSION }} --latest
214+
fi
181215
shell: bash
182216
env:
183217
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)