Skip to content

Commit a4640c5

Browse files
committed
Merge branch 'main' into release
2 parents 69310fd + 7945e56 commit a4640c5

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

.github/workflows/build.yaml

+16-11
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,16 @@ on:
55
branches:
66
- main
77
- release
8-
tags:
9-
- '**'
108
pull_request:
9+
release:
10+
types: [published]
1111

1212
jobs:
1313
build_prepare:
1414
name: Prepare build
1515
runs-on: ubuntu-22.04
1616
outputs:
1717
version: ${{ steps.version.outputs.version }}
18-
channel: ${{ steps.version.outputs.channel }}
1918
steps:
2019
- name: Checkout build repository
2120
uses: actions/checkout@v4
@@ -39,9 +38,13 @@ jobs:
3938
fi
4039
elif [ "${{ github.event_name }}" == "pull_request" ]; then
4140
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 }}"
4244
fi
4345
echo "Building version $version"
4446
echo "version=$version" >> "$GITHUB_OUTPUT"
47+
4548
- name: Checkout submodules
4649
working-directory: ./connectedhomeip/
4750
run: scripts/checkout_submodules.py --shallow --platform linux
@@ -72,10 +75,9 @@ jobs:
7275
build_linux_build_container:
7376
name: Build Linux container for Python wheels
7477
runs-on: ubuntu-22.04
75-
7678
permissions:
7779
contents: read
78-
packages: write # Required for pushing containers to the registry
80+
packages: write # Required for pushing containers to the registry
7981

8082
outputs:
8183
container_image: ${{ steps.set_container_tag.outputs.container_image }}
@@ -92,6 +94,7 @@ jobs:
9294
build_needed=false
9395
tag="${{ github.ref_name }}"
9496
97+
# Set tag based on base branch (use base branch for the release or pull request)
9598
if [ "${{ github.event_name }}" == "push" ]; then
9699
if git diff --name-only ${{ github.event.before }} HEAD | grep -E '^Dockerfile'; then
97100
echo "Dockerfile or related files changed; building container."
@@ -113,6 +116,8 @@ jobs:
113116
tag="${{ github.base_ref }}"
114117
fi
115118
fi
119+
elif [ "${{ github.event_name }}" == "release" ]; then
120+
tag="${{ github.event.release.target_commitish }}"
116121
fi
117122
118123
echo "Using container with tag: ${tag}"
@@ -157,7 +162,7 @@ jobs:
157162

158163
runs-on: ${{ matrix.arch.runner }}
159164
permissions:
160-
contents: write # for actions/upload-release-asset to upload release asset
165+
contents: write # Required for uploading artifacts and assets
161166

162167
defaults:
163168
run:
@@ -187,7 +192,7 @@ jobs:
187192
run: |
188193
scripts/build/gn_gen.sh --args=" \
189194
chip_project_config_include_dirs=[\"//..\"] \
190-
chip_crypto=\"boringssl\"
195+
chip_crypto=\"boringssl\" \
191196
enable_rtti=true \
192197
chip_config_memory_debug_checks=false \
193198
chip_config_memory_debug_dmalloc=false \
@@ -213,11 +218,11 @@ jobs:
213218
path: ./connectedhomeip/out/controller/python/*.whl
214219
- name: Upload wheels as release assets
215220
uses: softprops/action-gh-release@v2
216-
if: startsWith(github.ref, 'refs/tags/')
221+
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
217222
with:
218223
files: ./connectedhomeip/out/controller/python/*.whl
219224
- name: Upload wheels to PyPI
220-
if: startsWith(github.ref, 'refs/tags/')
225+
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
221226
env:
222227
TWINE_USERNAME: "__token__"
223228
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_PYPI }}
@@ -308,11 +313,11 @@ jobs:
308313
path: ./connectedhomeip/out/controller/python/*.whl
309314
- name: Upload wheels as release assets
310315
uses: softprops/action-gh-release@v2
311-
if: startsWith(github.ref, 'refs/tags/')
316+
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
312317
with:
313318
files: connectedhomeip/out/controller/python/*.whl
314319
- name: Upload wheels to PyPI
315-
if: startsWith(github.ref, 'refs/tags/')
320+
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
316321
env:
317322
TWINE_USERNAME: "__token__"
318323
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN_PYPI }}

0 commit comments

Comments
 (0)