Skip to content

Commit b99d043

Browse files
committed
build: minor updates in CI/CD workflow files
- polish code comments - wrap long lines Signed-off-by: Lukas Puehringer <[email protected]>
1 parent 674eb9d commit b99d043

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

.github/workflows/cd.yml

+13-20
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: CD
22
concurrency: cd
33

4-
# Trigger workflow on completed CI (further checks below)
4+
# Trigger workflow on any completed CI (see further checks below)
55
on:
66
workflow_run:
77
workflows: [CI]
@@ -11,18 +11,11 @@ jobs:
1111
build:
1212
name: Build
1313
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')
2619
outputs:
2720
release_id: ${{ steps.gh-release.outputs.id }}
2821
steps:
@@ -52,13 +45,10 @@ jobs:
5245
files: dist/*
5346

5447
- 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
6148
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.
6252
with:
6353
name: build-artifacts
6454
path: dist
@@ -90,5 +80,8 @@ jobs:
9080
repo: context.repo.repo,
9181
release_id: '${{ needs.build.outputs.release_id }}',
9282
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.'
9487
})

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
name: CI
22

33
on:
4+
# NOTE: CD relies on this configuration (see #1961)
45
push:
56
branches:
67
- develop
78
tags:
8-
# TODO: Should we restrict to vX.Y.Z tags?
99
- v*
1010

1111
pull_request:

0 commit comments

Comments
 (0)