Skip to content

Commit ef5fff1

Browse files
committed
Don't run release.yml on push except in testing
For now, this makes it so the `workflow_dispatch` event has to be used to run the `release.yml` workflow, except for fake testing releases (tags that end in `-DO-NOT-USE`). As noted in the explanatory comment, the `push` event rarely if ever occurs when tags are pushed to the `GitoxideLabs/gitoxide` repository. It is uncommon for a `gitoxide` crate release to be tagged at a commit that does not also have three or more library crates tagged. But `cargo smart-release` pushes all relevant tags at once, and GitHub Actions currently does not register a `push` event when more than three tags are pushed together. So the `release.yml` workflow is run via `workflow_dispatch` instead. The preceding commit adds `justfile` recipes to make it easier to trigger `release.yml` via `workflow_dispatch`. But this runs the risk that, in the rare case that there are few enough tags pushed for the `push` trigger to work, the workflow might be run more than once for the same release. Therefore, this prevents `push` from ever triggering the workflow for tags representing actual releases. See GitoxideLabs#1970 for some other details. (Allowing `push` to still work in testing makes it easier to test in a fork without risking accidentally triggering the workflow in the upstream repository. So the pattern is narrowed to still allow that, rather than being removed altogether, at least for now.)
1 parent e249706 commit ef5fff1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/release.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@ on:
77
push:
88
# Enable when testing release infrastructure on a branch.
99
# branches:
10-
# - fix-releases
10+
# - fix-releases
1111
tags:
12-
- 'v*'
12+
# For now, real releases always use `workflow_dispatch`, and running the workflow on tag pushes
13+
# is only done in testing. This is because we usually push too many tags at once for the `push`
14+
# event to be triggered, since there are usually more than 3 crates tagged together. So the
15+
# `push` trigger doesn't usually work. If we allow it, we risk running the workflow twice if
16+
# it is also manually triggered based on the assumption that it would not run. See #1970 for
17+
# details. See also the `run-release-workflow` and `roll-release` recipes in the `justfile`.
18+
# - 'v*'
19+
- 'v*-DO-NOT-USE' # Pattern for tags used to test the workflow (usually done in a fork).
1320
workflow_dispatch:
1421

1522
permissions:

0 commit comments

Comments
 (0)