Skip to content

Commit fc5b261

Browse files
authored
Merge pull request #46 from CSSFrancis/fix/docs-deploy-race
fix(ci): serialise docs deploys so release tags stop racing main
2 parents 1ea6bac + 5ee43d2 commit fc5b261

3 files changed

Lines changed: 26 additions & 3 deletions

File tree

.github/workflows/docs.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,13 @@ on:
1111
# Allow manual re-builds from the Actions tab.
1212
workflow_dispatch:
1313

14-
# Only one docs deployment should run at a time to avoid race conditions on
15-
# the gh-pages branch.
14+
# Per-ref grouping so a new push supersedes an in-flight BUILD of the same
15+
# ref (PR iterations, repeated pushes to main). This deliberately does NOT
16+
# serialise deployments: a push to main and its release tag are different
17+
# refs, so they land in different groups. The deploy job carries its own
18+
# ref-independent group for that — see below.
1619
concurrency:
17-
group: docs-${{ github.ref }}
20+
group: docs-build-${{ github.ref }}
1821
cancel-in-progress: true
1922

2023
permissions:
@@ -91,6 +94,17 @@ jobs:
9194
# Skip deployment for pull requests.
9295
if: github.event_name != 'pull_request'
9396

97+
# Every deploy pushes to the SAME branch (gh-pages), so they must be
98+
# serialised across refs, not per-ref. Releasing tags main and v* almost
99+
# simultaneously, which previously raced: whichever run pushed second was
100+
# rejected with "cannot lock ref 'refs/heads/gh-pages'" and its version
101+
# directory never appeared, while switcher.json still advertised it.
102+
# cancel-in-progress is false because these runs must QUEUE — cancelling
103+
# one would drop a version directory just as surely as the race did.
104+
concurrency:
105+
group: docs-deploy
106+
cancel-in-progress: false
107+
94108
steps:
95109
- name: Checkout repository
96110
uses: actions/checkout@v4
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Fixed the docs deployment racing itself on release. A push to ``main`` and its
2+
release tag are different refs, so the ``docs-${{ github.ref }}`` concurrency
3+
group put them in separate groups and both pushed to ``gh-pages`` at once; the
4+
loser was rejected and its versioned directory never appeared, while
5+
``switcher.json`` still advertised the version. The deploy job now uses a
6+
ref-independent group so deployments queue instead.

upcoming_changes/.gitkeep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# This file keeps the upcoming_changes/ directory tracked by git.
2+
# Replace it with real fragment files (e.g. 42.new_feature.rst) as PRs land.
3+

0 commit comments

Comments
 (0)