-
Notifications
You must be signed in to change notification settings - Fork 1.9k
130 lines (112 loc) · 4.05 KB
/
publish.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
name: Publish on Pypi
on:
workflow_dispatch:
inputs:
version:
description: "The tag of the package to publish on Pypi (ex: 1.0.0, 1.0.0.dev0)"
required: true
jobs:
test-package:
timeout-minutes: 20
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Extract Github Tag Version
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Download assets from github release tag
run: |
gh release download ${{ github.event.inputs.version }} --dir dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify if all releases exist
run: |
python tools/release/check_releases.py dist ${{ github.event.inputs.version }}
publish-subpackages-to-pypi:
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
needs: [test-package]
timeout-minutes: 20
strategy:
matrix:
package: [ config, core, gui, rest, templates ]
max-parallel: 1
environment: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: taipy/${{ matrix.package }}
sparse-checkout-cone-mode: false
- name: Checks if package is already on Pypi
id: check-version
run: |
if curl https://pypi.org/simple/taipy-${{ matrix.package }} | grep -o ">taipy-${{ matrix.package }}-${{ github.event.inputs.version }}\.tar\.gz<"; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Download assets from tag
if: steps.check-version.outputs.exists == 'false'
run: |
gh release download ${{ github.event.inputs.version }}-${{ matrix.package }} --dir dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PyPI
if: steps.check-version.outputs.exists == 'false'
uses: pypa/gh-action-pypi-publish@release/v1
publish-main-package-to-pypi:
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
needs: [publish-subpackages-to-pypi, test-package ]
timeout-minutes: 20
environment: publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checks if package is already on on Pypi
id: check-version
run: |
if curl https://pypi.org/simple/taipy | grep -o ">taipy-${{ github.event.inputs.version }}\.tar\.gz<"; then
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Download assets from tag
if: steps.check-version.outputs.exists == 'false'
run: |
gh release download ${{ github.event.inputs.version }} --dir dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PyPI
if: steps.check-version.outputs.exists == 'false'
uses: pypa/gh-action-pypi-publish@release/v1
test-published-package:
needs: [publish-main-package-to-pypi]
timeout-minutes: 30
strategy:
matrix:
python-versions: ['3.8','3.9','3.10', '3.11', '3.12']
os: [ubuntu-latest,windows-latest,macos-13]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-versions }}
- name: Prepare tests on unix
if: matrix.os != 'windows-latest'
run: |
rm -rf taipy
- name: Prepare tests on windows
if: matrix.os == 'windows-latest'
run: |
rmdir -Recurse -Force taipy
- name: Install and test package
run: |
pip install --upgrade pip
pip install --no-cache-dir ${{ github.event.repository.name }}==${{ github.event.inputs.version }}
python tools/validate_taipy_install.py