88 branches :
99 - main
1010 - dev
11+ pull_request :
12+ branches :
13+ - main
14+ - dev
15+ paths-ignore :
16+ - .github/*
1117
1218jobs :
1319 changes :
9399 name : Semantic Release
94100 runs-on : ubuntu-latest
95101 needs : [lint]
96- if : github.ref == 'refs/heads/main' && github.repository == '3dct/viqa' && always()
102+ if : >-
103+ ${{
104+ github.ref == 'refs/heads/main' &&
105+ github.repository == '3dct/viqa' &&
106+ github.event_name != 'pull_request' && !cancelled()
107+ }}
97108 permissions :
98109 id-token : write
99110 contents : write
@@ -113,7 +124,7 @@ jobs:
113124
114125 - name : Python Semantic Release
115126 id : release
116- uses : python-semantic-release/python-semantic-release@v9.12 .0
127+ uses : python-semantic-release/python-semantic-release@v9.21 .0
117128 with :
118129 github_token : ${{ secrets.GITHUB_TOKEN }}
119130 git_committer_name : " github-actions"
@@ -123,10 +134,12 @@ jobs:
123134 name : Build wheels on ${{ matrix.os }}
124135 runs-on : ${{ matrix.os }}
125136 needs : [changes, semantic_release]
126- if : |
127- (needs.changes.outputs.build-changes == 'true' ||
128- needs.changes.outputs.src-changes == 'true' ||
129- needs.changes.outputs.ci-changes == 'true') && always()
137+ if : >-
138+ ${{
139+ (needs.changes.outputs.build-changes == 'true' ||
140+ needs.changes.outputs.src-changes == 'true' ||
141+ needs.changes.outputs.ci-changes == 'true') && !cancelled()
142+ }}
130143 strategy :
131144 fail-fast : false
132145 matrix :
@@ -154,8 +167,6 @@ jobs:
154167
155168 - name : Build wheels
156169 uses : pypa/cibuildwheel@v2.19.2
157- env :
158- CIBW_PRERELEASE_PYTHONS : true
159170 with :
160171 package-dir : .
161172 output-dir : wheelhouse
@@ -171,10 +182,12 @@ jobs:
171182 name : Build source distribution
172183 runs-on : ubuntu-24.04
173184 needs : [changes, semantic_release]
174- if : |
175- (needs.changes.outputs.build-changes == 'true' ||
176- needs.changes.outputs.src-changes == 'true' ||
177- needs.changes.outputs.ci-changes == 'true') && always()
185+ if : >-
186+ ${{
187+ (needs.changes.outputs.build-changes == 'true' ||
188+ needs.changes.outputs.src-changes == 'true' ||
189+ needs.changes.outputs.ci-changes == 'true') && !cancelled()
190+ }}
178191 steps :
179192 - name : Checkout code
180193 uses : actions/checkout@v4
@@ -194,9 +207,11 @@ jobs:
194207 upload_testpypi :
195208 name : Upload to Test PyPI
196209 needs : [semantic_release, build_wheels, build_sdist]
197- if : |
198- (github.ref == 'refs/heads/dev' && startsWith(github.ref, 'refs/tags/v')) ||
199- (github.ref == 'refs/heads/main' && needs.semantic_release.outputs.released == 'true')
210+ if : >-
211+ ${{
212+ (github.ref == 'refs/heads/dev' && startsWith(github.ref, 'refs/tags/v')) ||
213+ (github.ref == 'refs/heads/main' && needs.semantic_release.outputs.released == 'true')
214+ }}
200215 runs-on : ubuntu-latest
201216 environment :
202217 name : testpypi
@@ -238,8 +253,8 @@ jobs:
238253 with :
239254 python-version : ${{ vars.MINIMAL_PYTHON_VERSION }}
240255
241- - name : Pause for 60 seconds
242- run : sleep 60
256+ - name : Pause for 120 seconds
257+ run : sleep 120
243258
244259 - name : Test install from Test PyPI
245260 if : ${{ matrix.os == 'macos-14' || matrix.os == 'ubuntu-24.04' }}
@@ -269,11 +284,14 @@ jobs:
269284 name : Upload to PyPI
270285 needs : [semantic_release, build_wheels, build_sdist, upload_testpypi, test_install]
271286 runs-on : ubuntu-latest
272- if : |
273- needs.semantic_release.outputs.released == 'true' &&
274- needs.semantic_release.outputs.is_prerelease == 'false' &&
275- needs.test_install.outputs.tested == 'true' &&
276- needs.test_install.outputs.tested_windows == 'true'
287+ if : >-
288+ ${{
289+ (github.ref == 'refs/heads/main' && needs.semantic_release.outputs.released == 'true') &&
290+ needs.semantic_release.outputs.released == 'true' &&
291+ needs.semantic_release.outputs.is_prerelease == 'false' &&
292+ needs.test_install.outputs.tested == 'true' &&
293+ needs.test_install.outputs.tested_windows == 'true'
294+ }}
277295 environment :
278296 name : pypi
279297 url : https://pypi.org/project/vIQA/
@@ -296,11 +314,14 @@ jobs:
296314 name : Upload to GitHub Releases
297315 needs : [semantic_release, build_wheels, build_sdist, test_install]
298316 runs-on : ubuntu-latest
299- if : |
300- needs.semantic_release.outputs.released == 'true' &&
301- needs.semantic_release.outputs.is_prerelease == 'false' &&
302- needs.test_install.outputs.tested == 'true' &&
303- needs.test_install.outputs.tested_windows == 'true'
317+ if : >-
318+ ${{
319+ (github.ref == 'refs/heads/main' && needs.semantic_release.outputs.released == 'true') &&
320+ needs.semantic_release.outputs.released == 'true' &&
321+ needs.semantic_release.outputs.is_prerelease == 'false' &&
322+ needs.test_install.outputs.tested == 'true' &&
323+ needs.test_install.outputs.tested_windows == 'true'
324+ }}
304325 permissions :
305326 id-token : write
306327 contents : write
@@ -328,24 +349,22 @@ jobs:
328349 ./dist/*.whl
329350
330351 - name : Publish package distributions to GitHub Releases
331- uses : python-semantic-release/publish-action@v9.12 .0
352+ uses : python-semantic-release/publish-action@v9.21 .0
332353 with :
333354 github_token : ${{ secrets.GITHUB_TOKEN }}
334355
335356 prepare_publish_input :
336357 name : Check if published
337358 runs-on : ubuntu-latest
338- if : |
339- (needs.changes.outputs.doc-changes == 'true' ||
340- needs.changes.outputs.docker-changes == 'true') && always()
359+ if : ${{ !cancelled() }}
341360 outputs :
342361 docs_publish : ${{ steps.check_docs_publish.outputs.publish }}
343362 image_publish : ${{ steps.check_image_publish.outputs.publish }}
344363 needs : [changes, upload_github, upload_pypi]
345364 steps :
346365 - name : Check if documentation should be published
347366 id : check_docs_publish
348- if : needs.changes.outputs.doc-changes == 'true'
367+ if : ${{ needs.changes.outputs.doc-changes == 'true' }}
349368 run : |
350369 # If either the PyPI or GitHub release was successful, publish the docs
351370 if ${{ needs.upload_github.result == 'success' }} || ${{ needs.upload_pypi.result == 'success' }}; then
@@ -360,10 +379,10 @@ jobs:
360379 fi
361380 - name : Check if Docker images should be published
362381 id : check_image_publish
363- if : needs.changes.outputs.docker-changes == 'true'
382+ if : ${{ needs.changes.outputs.docker-changes == 'true' }}
364383 run : |
365384 # If either the PyPI or GitHub release was successful, publish the Docker images
366- if ${{ needs.upload_github.result == 'success' }} || ${{ needs.upload_pypi.result == 'success' }} ; then
385+ if ${{ needs.upload_github.result }} == 'success' || ${{ needs.upload_pypi.result }} == 'success'; then
367386 echo "publish=true" >> $GITHUB_OUTPUT
368387 else
369388 echo "publish=false" >> $GITHUB_OUTPUT
@@ -373,15 +392,15 @@ jobs:
373392 name : Build and deploy documentation
374393 uses : ./.github/workflows/documentation.yaml
375394 needs : [changes, prepare_publish_input]
376- if : github.repository == '3dct/viqa' && needs.changes.outputs.doc-changes == 'true'
395+ if : ${{ github.repository == '3dct/viqa' && needs.changes.outputs.doc-changes == 'true' }}
377396 with :
378397 publish : ${{ needs.prepare_publish_input.outputs.docs_publish }}
379398
380399 build_and_push_docker_images :
381400 name : Build and push Docker Images
382401 uses : ./.github/workflows/build_and_push_docker_images.yaml
383402 needs : [changes, semantic_release, prepare_publish_input]
384- if : github.repository == '3dct/viqa' && needs.changes.outputs.docker-changes == 'true'
403+ if : ${{ github.repository == '3dct/viqa' && needs.changes.outputs.docker-changes == 'true' }}
385404 with :
386405 version : ${{ needs.semantic_release.outputs.version }}
387406 publish : ${{ needs.prepare_publish_input.outputs.image_publish }}
0 commit comments