Skip to content

Commit a7b863a

Browse files
ci: 241 release pipeline does not depend on tests (#257)
[ACQP-380](https://jira.diamond.ac.uk/browse/ACQP-380) Closes #241
2 parents 1c71289 + 9b0a62b commit a7b863a

File tree

4 files changed

+26
-8
lines changed

4 files changed

+26
-8
lines changed

.github/workflows/_container.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
on:
22
workflow_call:
3+
inputs:
4+
publish:
5+
type: boolean
6+
description: If true, pushes image to container registry
37

48
jobs:
59
build:
@@ -47,7 +51,7 @@ jobs:
4751
type=raw,value=latest
4852
4953
- name: Push cached image to container registry
50-
if: github.ref_type == 'tag'
54+
if: inputs.publish && github.ref_type == 'tag'
5155
uses: docker/build-push-action@v6
5256
env:
5357
DOCKER_BUILD_RECORD_UPLOAD: false

.github/workflows/_docs.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
on:
22
workflow_call:
3+
inputs:
4+
publish:
5+
type: boolean
6+
description: If true, publishes docs to gh-pages
7+
38

49
jobs:
510
build:
@@ -44,7 +49,7 @@ jobs:
4449
run: python .github/pages/make_switcher.py --add $DOCS_VERSION ${{ github.repository }} .github/pages/switcher.json
4550

4651
- name: Publish Docs to gh-pages
47-
if: github.ref_type == 'tag' || github.ref_name == 'main'
52+
if: inputs.publish && (github.ref_type == 'tag' || github.ref_name == 'main')
4853
# We pin to the SHA, not the tag, for security reasons.
4954
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
5055
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424

2525
docs:
2626
uses: ./.github/workflows/_docs.yml
27+
with:
28+
publish: ${{needs.test.result == 'success'}}
2729
permissions:
2830
contents: write
2931

@@ -35,8 +37,8 @@ jobs:
3537
EXAMPLE_DEPLOY_KEY: ${{ secrets.EXAMPLE_DEPLOY_KEY }}
3638

3739
release:
40+
needs: [test, docs]
3841
if: github.ref_type == 'tag'
39-
needs: docs
4042
uses: ./.github/workflows/_release.yml
4143
permissions:
4244
contents: write

template/{% if git_platform=="github.com" %}.github{% endif %}/workflows/ci.yml.jinja

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,36 @@ jobs:
2727
python-version: ${{ matrix.python-version }}
2828
secrets:
2929
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
30-
{% endraw %}{% if docker %}
30+
{% endraw %}{% if docker %}{% raw %}
3131
container:
32+
needs: test
33+
if: always()
3234
uses: ./.github/workflows/_container.yml
35+
with:
36+
publish: ${{ needs.test.result == 'success' }}
3337
permissions:
3438
contents: read
3539
packages: write
36-
{% endif %}{% if sphinx %}
40+
{% endraw %}{% endif %}{% if sphinx %}{% raw %}
3741
docs:
3842
uses: ./.github/workflows/_docs.yml
39-
{% endif %}
43+
with:
44+
publish: ${{ needs.test.result == 'success' }}
45+
46+
{% endraw %}{% endif %}
4047
dist:
4148
uses: ./.github/workflows/_dist.yml
4249
{% if pypi %}
4350
pypi:
51+
needs: [dist, test]
4452
if: github.ref_type == 'tag'
45-
needs: dist
4653
uses: ./.github/workflows/_pypi.yml
4754
permissions:
4855
id-token: write
4956
{% endif %}
5057
release:
58+
needs: [dist, test{% if sphinx %}, docs{% endif %}]
5159
if: github.ref_type == 'tag'
52-
needs: [dist{% if sphinx %}, docs{% endif %}]
5360
uses: ./.github/workflows/_release.yml
5461
permissions:
5562
contents: write

0 commit comments

Comments
 (0)