Skip to content

Commit 7dda68e

Browse files
committed
ci: fix condition escaping in release.yaml
1 parent 914424c commit 7dda68e

File tree

1 file changed

+43
-31
lines changed

1 file changed

+43
-31
lines changed

.github/workflows/release.yaml

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,12 @@ jobs:
9999
name: Semantic Release
100100
runs-on: ubuntu-latest
101101
needs: [lint]
102-
if: |
103-
github.ref == 'refs/heads/main' &&
104-
github.repository == '3dct/viqa' &&
105-
github.event_name != 'pull_request' && '!cancelled()'
102+
if: >-
103+
${{
104+
github.ref == 'refs/heads/main' &&
105+
github.repository == '3dct/viqa' &&
106+
github.event_name != 'pull_request' && !cancelled()
107+
}}
106108
permissions:
107109
id-token: write
108110
contents: write
@@ -132,10 +134,12 @@ jobs:
132134
name: Build wheels on ${{ matrix.os }}
133135
runs-on: ${{ matrix.os }}
134136
needs: [changes, semantic_release]
135-
if: |
136-
(needs.changes.outputs.build-changes == 'true' ||
137-
needs.changes.outputs.src-changes == 'true' ||
138-
needs.changes.outputs.ci-changes == 'true') && '!cancelled()'
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+
}}
139143
strategy:
140144
fail-fast: false
141145
matrix:
@@ -180,10 +184,12 @@ jobs:
180184
name: Build source distribution
181185
runs-on: ubuntu-24.04
182186
needs: [changes, semantic_release]
183-
if: |
184-
(needs.changes.outputs.build-changes == 'true' ||
185-
needs.changes.outputs.src-changes == 'true' ||
186-
needs.changes.outputs.ci-changes == 'true') && '!cancelled()'
187+
if: >-
188+
${{
189+
(needs.changes.outputs.build-changes == 'true' ||
190+
needs.changes.outputs.src-changes == 'true' ||
191+
needs.changes.outputs.ci-changes == 'true') && !cancelled()
192+
}}
187193
steps:
188194
- name: Checkout code
189195
uses: actions/checkout@v4
@@ -203,9 +209,11 @@ jobs:
203209
upload_testpypi:
204210
name: Upload to Test PyPI
205211
needs: [semantic_release, build_wheels, build_sdist]
206-
if: |
207-
(github.ref == 'refs/heads/dev' && startsWith(github.ref, 'refs/tags/v')) ||
208-
(github.ref == 'refs/heads/main' && needs.semantic_release.outputs.released == 'true')
212+
if: >-
213+
${{
214+
(github.ref == 'refs/heads/dev' && startsWith(github.ref, 'refs/tags/v')) ||
215+
(github.ref == 'refs/heads/main' && needs.semantic_release.outputs.released == 'true')
216+
}}
209217
runs-on: ubuntu-latest
210218
environment:
211219
name: testpypi
@@ -278,11 +286,13 @@ jobs:
278286
name: Upload to PyPI
279287
needs: [semantic_release, build_wheels, build_sdist, upload_testpypi, test_install]
280288
runs-on: ubuntu-latest
281-
if: |
282-
needs.semantic_release.outputs.released == 'true' &&
283-
needs.semantic_release.outputs.is_prerelease == 'false' &&
284-
needs.test_install.outputs.tested == 'true' &&
285-
needs.test_install.outputs.tested_windows == 'true'
289+
if: >-
290+
${{
291+
needs.semantic_release.outputs.released == 'true' &&
292+
needs.semantic_release.outputs.is_prerelease == 'false' &&
293+
needs.test_install.outputs.tested == 'true' &&
294+
needs.test_install.outputs.tested_windows == 'true'
295+
}}
286296
environment:
287297
name: pypi
288298
url: https://pypi.org/project/vIQA/
@@ -305,11 +315,13 @@ jobs:
305315
name: Upload to GitHub Releases
306316
needs: [semantic_release, build_wheels, build_sdist, test_install]
307317
runs-on: ubuntu-latest
308-
if: |
309-
needs.semantic_release.outputs.released == 'true' &&
310-
needs.semantic_release.outputs.is_prerelease == 'false' &&
311-
needs.test_install.outputs.tested == 'true' &&
312-
needs.test_install.outputs.tested_windows == 'true'
318+
if: >-
319+
${{
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+
}}
313325
permissions:
314326
id-token: write
315327
contents: write
@@ -344,15 +356,15 @@ jobs:
344356
prepare_publish_input:
345357
name: Check if published
346358
runs-on: ubuntu-latest
347-
if: '!cancelled()'
359+
if: ${{ !cancelled() }}
348360
outputs:
349361
docs_publish: ${{ steps.check_docs_publish.outputs.publish }}
350362
image_publish: ${{ steps.check_image_publish.outputs.publish }}
351363
needs: [changes, upload_github, upload_pypi]
352364
steps:
353365
- name: Check if documentation should be published
354366
id: check_docs_publish
355-
if: needs.changes.outputs.doc-changes == 'true'
367+
if: ${{ needs.changes.outputs.doc-changes == 'true' }}
356368
run: |
357369
# If either the PyPI or GitHub release was successful, publish the docs
358370
if ${{ needs.upload_github.result == 'success' }} || ${{ needs.upload_pypi.result == 'success' }}; then
@@ -367,10 +379,10 @@ jobs:
367379
fi
368380
- name: Check if Docker images should be published
369381
id: check_image_publish
370-
if: needs.changes.outputs.docker-changes == 'true'
382+
if: ${{ needs.changes.outputs.docker-changes == 'true' }}
371383
run: |
372384
# If either the PyPI or GitHub release was successful, publish the Docker images
373-
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
374386
echo "publish=true" >> $GITHUB_OUTPUT
375387
else
376388
echo "publish=false" >> $GITHUB_OUTPUT
@@ -380,15 +392,15 @@ jobs:
380392
name: Build and deploy documentation
381393
uses: ./.github/workflows/documentation.yaml
382394
needs: [changes, prepare_publish_input]
383-
if: github.repository == '3dct/viqa' && needs.changes.outputs.doc-changes == 'true'
395+
if: ${{ github.repository == '3dct/viqa' && needs.changes.outputs.doc-changes == 'true' }}
384396
with:
385397
publish: ${{ needs.prepare_publish_input.outputs.docs_publish }}
386398

387399
build_and_push_docker_images:
388400
name: Build and push Docker Images
389401
uses: ./.github/workflows/build_and_push_docker_images.yaml
390402
needs: [changes, semantic_release, prepare_publish_input]
391-
if: github.repository == '3dct/viqa' && needs.changes.outputs.docker-changes == 'true'
403+
if: ${{ github.repository == '3dct/viqa' && needs.changes.outputs.docker-changes == 'true' }}
392404
with:
393405
version: ${{ needs.semantic_release.outputs.version }}
394406
publish: ${{ needs.prepare_publish_input.outputs.image_publish }}

0 commit comments

Comments
 (0)