1
1
name : CD
2
2
concurrency : cd
3
3
4
- # Trigger workflow on completed CI (further checks below)
4
+ # Trigger workflow on any completed CI (see further checks below)
5
5
on :
6
6
workflow_run :
7
7
workflows : [CI]
@@ -11,18 +11,11 @@ jobs:
11
11
build :
12
12
name : Build
13
13
runs-on : ubuntu-latest
14
- # Skip unless CI was successful and ran on a ref starting with 'v' (release tag)
15
- if : ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.event.workflow_run.head_branch, 'v') }}
16
- # NOTE: This works because we currently only trigger CI on a push to the 'develop'
17
- # branch or a 'v*'-tag, but it seems rather brittle.
18
- # Unfortunately, there is not much more info we get from the CI workflow
19
- # ('workflow_run') than the ref name. No ref, ref_type, etc., so we don't even know
20
- # if a tag or a branch was pushed. :(
21
- # See https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_run
22
- # NOTE: (2) An alternative solution might be to restructure workflows, so that all
23
- # test logic from 'ci.yml' is moved to a separate workflow file '_test.yml', that
24
- # can be included in both CI (triggered on push to 'develop'-branch) and CD
25
- # (triggered on push to 'v*'-tag) workflows.
14
+ # Skip unless CI was successful and ran on release tag, a ref starting with 'v'.
15
+ # NOTE: We assume CI does not trigger on branches that start with 'v' (see #1961)
16
+ if : >-
17
+ github.event.workflow_run.conclusion == 'success' &&
18
+ startsWith(github.event.workflow_run.head_branch, 'v')
26
19
outputs :
27
20
release_id : ${{ steps.gh-release.outputs.id }}
28
21
steps :
@@ -52,13 +45,10 @@ jobs:
52
45
files : dist/*
53
46
54
47
- name : Store build artifacts
55
- # NOTE: The release job could download the assets from the GitHub release page,
56
- # published in the previous step. But using the GitHub upload/download actions
57
- # seems more robust as there is no need to compute download URLs.
58
- # NOTE: (2) action-gh-release returns download URLSs as output, which could be
59
- # propagated to next job along with release_id (see above)
60
- # https://github.com/softprops/action-gh-release#outputs
61
48
uses : actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535
49
+ # NOTE: The GitHub release page contains the release artifacts too, but using
50
+ # GitHub upload/download actions seems robuster: there is no need to compute
51
+ # download URLs and tampering with artifacts between jobs is more limited.
62
52
with :
63
53
name : build-artifacts
64
54
path : dist
90
80
repo: context.repo.repo,
91
81
release_id: '${{ needs.build.outputs.release_id }}',
92
82
name: '${{ github.event.workflow_run.head_branch }}',
93
- body: 'See [CHANGELOG.md](https://github.com/'+ context.repo.owner +'/'+ context.repo.repo +'/blob/${{ github.event.workflow_run.head_branch }}/docs/CHANGELOG.md) for details.'
83
+ body: 'See [CHANGELOG.md](https://github.com/' +
84
+ context.repo.owner + '/' + context.repo.repo + '/blob/' +
85
+ '${{ github.event.workflow_run.head_branch }}'+
86
+ '/docs/CHANGELOG.md) for details.'
94
87
})
0 commit comments