5
5
branches :
6
6
- main
7
7
- release
8
- tags :
9
- - ' **'
10
8
pull_request :
9
+ release :
10
+ types : [published]
11
11
12
12
jobs :
13
13
build_prepare :
14
14
name : Prepare build
15
15
runs-on : ubuntu-22.04
16
16
outputs :
17
17
version : ${{ steps.version.outputs.version }}
18
- channel : ${{ steps.version.outputs.channel }}
19
18
steps :
20
19
- name : Checkout build repository
21
20
uses : actions/checkout@v4
39
38
fi
40
39
elif [ "${{ github.event_name }}" == "pull_request" ]; then
41
40
version="${calver_date}+pr${version%%/*}"
41
+ elif [ "${{ github.event_name }}" == "release" ]; then
42
+ # Use tag name for release version
43
+ version="${{ github.event.release.tag_name }}"
42
44
fi
43
45
echo "Building version $version"
44
46
echo "version=$version" >> "$GITHUB_OUTPUT"
47
+
45
48
- name : Checkout submodules
46
49
working-directory : ./connectedhomeip/
47
50
run : scripts/checkout_submodules.py --shallow --platform linux
72
75
build_linux_build_container :
73
76
name : Build Linux container for Python wheels
74
77
runs-on : ubuntu-22.04
75
-
76
78
permissions :
77
79
contents : read
78
- packages : write # Required for pushing containers to the registry
80
+ packages : write # Required for pushing containers to the registry
79
81
80
82
outputs :
81
83
container_image : ${{ steps.set_container_tag.outputs.container_image }}
92
94
build_needed=false
93
95
tag="${{ github.ref_name }}"
94
96
97
+ # Set tag based on base branch (use base branch for the release or pull request)
95
98
if [ "${{ github.event_name }}" == "push" ]; then
96
99
if git diff --name-only ${{ github.event.before }} HEAD | grep -E '^Dockerfile'; then
97
100
echo "Dockerfile or related files changed; building container."
@@ -113,6 +116,8 @@ jobs:
113
116
tag="${{ github.base_ref }}"
114
117
fi
115
118
fi
119
+ elif [ "${{ github.event_name }}" == "release" ]; then
120
+ tag="${{ github.event.release.target_commitish }}"
116
121
fi
117
122
118
123
echo "Using container with tag: ${tag}"
@@ -157,7 +162,7 @@ jobs:
157
162
158
163
runs-on : ${{ matrix.arch.runner }}
159
164
permissions :
160
- contents : write # for actions/upload-release-asset to upload release asset
165
+ contents : write # Required for uploading artifacts and assets
161
166
162
167
defaults :
163
168
run :
@@ -187,7 +192,7 @@ jobs:
187
192
run : |
188
193
scripts/build/gn_gen.sh --args=" \
189
194
chip_project_config_include_dirs=[\"//..\"] \
190
- chip_crypto=\"boringssl\"
195
+ chip_crypto=\"boringssl\" \
191
196
enable_rtti=true \
192
197
chip_config_memory_debug_checks=false \
193
198
chip_config_memory_debug_dmalloc=false \
@@ -213,11 +218,11 @@ jobs:
213
218
path : ./connectedhomeip/out/controller/python/*.whl
214
219
- name : Upload wheels as release assets
215
220
uses : softprops/action-gh-release@v2
216
- if : startsWith( github.ref, 'refs/tags/')
221
+ if : ${{ github.event_name == 'release' && github.event.action == 'published' }}
217
222
with :
218
223
files : ./connectedhomeip/out/controller/python/*.whl
219
224
- name : Upload wheels to PyPI
220
- if : startsWith( github.ref, 'refs/tags/')
225
+ if : ${{ github.event_name == 'release' && github.event.action == 'published' }}
221
226
env :
222
227
TWINE_USERNAME : " __token__"
223
228
TWINE_PASSWORD : ${{ secrets.TWINE_TOKEN_PYPI }}
@@ -308,11 +313,11 @@ jobs:
308
313
path : ./connectedhomeip/out/controller/python/*.whl
309
314
- name : Upload wheels as release assets
310
315
uses : softprops/action-gh-release@v2
311
- if : startsWith( github.ref, 'refs/tags/')
316
+ if : ${{ github.event_name == 'release' && github.event.action == 'published' }}
312
317
with :
313
318
files : connectedhomeip/out/controller/python/*.whl
314
319
- name : Upload wheels to PyPI
315
- if : startsWith( github.ref, 'refs/tags/')
320
+ if : ${{ github.event_name == 'release' && github.event.action == 'published' }}
316
321
env :
317
322
TWINE_USERNAME : " __token__"
318
323
TWINE_PASSWORD : ${{ secrets.TWINE_TOKEN_PYPI }}
0 commit comments