fix: support concurrent documentation deploys to GitHub Pages

When multiple release/snapshot builds publish documentation at the same
time, their pushes to the documentation branch race. Previously a rejected
push triggered a plain `git pull --rebase`, which stops on a merge conflict
in the shared folders (latest, X.X.x, index.html, snapshot) and, under
`set -e`, kills the whole job - so concurrent releases fail.

Make the retry loop concurrency-safe:

- Rebase the deploy commit onto the remote with `-X theirs` so shared-folder
  file conflicts auto-resolve in favour of this deploy, and add bounded
  backoff with jitter between attempts.
- Reconcile owned paths after the rebase: purge-owned folders are restored
  wholesale from the deploy commit (clean last-writer-wins) while merge-mode
  folders and other deploys' independent version folders are preserved.
- Keep `latest` as highest-version-wins: a lower release replayed after a
  concurrent higher release yields `latest` back to the remote instead of
  overwriting it with older docs.
- Resolve modify/delete rebase conflicts that `-X theirs` cannot handle
  (a file this deploy purges but a concurrent deploy modified) by driving
  the rebase to completion deterministically instead of aborting.

Add a Testcontainers regression test that lands a concurrent deploy
modifying a purged file and asserts the retry recovers cleanly.

Assisted-by: claude-code:claude-4.8-opus
2 files changed
tree: 8c11f197127b608abce1dfc4c5e21b02fb97f9e9
  1. .github/
  2. cascade-merge/
  3. deploy-github-pages/
  4. etc/
  5. export-gradle-properties/
  6. licenses/
  7. post-release/
  8. pre-release/
  9. tests/
  10. .asf.yaml
  11. .gitignore
  12. LICENSE
  13. NOTICE
  14. README.md
README.md

Apache Grails - GitHub Actions

CI Users Mailing List Dev Mailing List Slack

Introduction

This repository hosts GitHub Actions that power the release workflows for Apache Grails & related projects.

Actions include:

  1. pre-release - handles setting the project version based on the Git tag & running various pre-release tasks.
  2. deploy-github-pages - handles publishing documentation to GitHub Pages for both snapshots & releases.
  3. post-release - assists in merging tagged changes back to the target branch & bumping to the next development version.
  4. export-gradle-properties - exposes selected Gradle properties as environment variables.
  5. cascade-merge - merges a branch forward through an explicit ordered list of downstream branches when there are no conflicts.

Who can use these actions

These actions are meant to assist in using the GitHub Release feature to produce a published release. They were primarily designed for Gradle projects that need to set a version & automate parts of the release process such as the changing of the project version & publishing documentation.

Usages

Used by: https://github.com/search?q=org%3Aapache+%22uses%3A+apache%2Fgrails-github-actions%2F%22+language%3Ayml&type=code

Further information

To use these actions, please refer to the individual README files in each action's directory.

Testing

To bootstrap the test project so it can be run against the source distribution, execute:

cd tests/gradle-bootstrap
gradle bootstrap

Then to run the tests, execute:

cd ..
gradle check