Add a manually-triggered site publishing workflow - #62
Conversation
Site publishing is currently entirely manual and undocumented per repository, which is why gh-pages branches range from May 2023 to June 2026. This gives every project one button instead. Deliberately workflow_dispatch rather than release-triggered: it puts no unreviewed content live, and Maven site builds break often enough that a person should see the output. Handles both layouts. Single-module projects bind scm-publish to site-deploy and set content to target/site; multi-module projects need site:stage first, and the plugin's default content is target/staging, so the multi-module input switches goals and nothing else. The POMs derive pubScmUrl from scm.developerConnection, which is an ssh URL that cannot authenticate in Actions. The workflow overrides it to https and supplies the credential through a git insteadOf rule, so the job token stays out of the command line and the process list. A dry-run input builds the site and checks out gh-pages without committing, so the first use in a repository can be verified safely.
There was a problem hiding this comment.
Pull request overview
Introduces a reusable GitHub Actions workflow intended to provide a single, manually triggered (“one button”) procedure for generating and publishing Maven project sites to the gh-pages branch across repositories in the codehaus-plexus org.
Changes:
- Adds a reusable
workflow_callworkflow to build and publish Maven sites. - Supports both single-module and multi-module site publishing flows, plus a
dry-runmode. - Configures Git authentication for pushing to
gh-pagesusing the job token.
Suppressed comments (2)
.github/workflows/site.yml:90
- This expression references a hyphenated input name (
maven-version) via dot notation. Use bracket notation (inputs['maven-version']) to avoid the expression being parsed as subtraction and failing at runtime.
run: mvn --errors --batch-mode --show-version org.apache.maven.plugins:maven-wrapper-plugin:3.2.0:wrapper "-Dtype=only-script" "-Dmaven=${{ inputs.maven-version }}"
.github/workflows/site.yml:109
- Hyphenated inputs (
multi-module,dry-run) are accessed with dot notation here, which GitHub Actions will parse as arithmetic (e.g.inputs.multi-module). Use bracket notation for these input names so the conditional goals selection and dry-run flag work.
./mvnw ${{ inputs.maven_args }} \
${{ inputs.multi-module && 'site site:stage scm-publish:publish-scm' || 'site-deploy' }} \
"-Dscmpublish.pubScmUrl=scm:git:https://github.com/${{ github.repository }}.git" \
"-Dscmpublish.scm.branch=gh-pages" \
"-Dscmpublish.dryRun=${{ inputs.dry-run }}" \
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Thanks — I checked this one rather than applying it, and I believe the review is mistaken. No change made; here is the evidence. The claim: hyphenated input names cannot be read with dot notation, because This organisation's existing shared workflows already do exactly that, and have been running across every repository here for a long time:
GitHub's own reusable-workflow documentation uses the same form in its worked example ( So dot notation on hyphenated inputs is fine, and switching to bracket notation would make this workflow inconsistent with the two shared workflows beside it for no benefit. Two things worth saying about the risk, since I would rather not be quietly wrong here:
Happy to be shown otherwise if someone has a counter-example. |
plexus-sec-dispatcher now has the scm-publish binding every other single-module project uses, so the documented command works there too. Removes the 'Known gap' section. Replaces 'why this isn't automated' with how to use the Publish Site workflow, and keeps the reasoning for why it is triggered by hand rather than on release. Follow-up to codehaus-plexus/plexus-sec-dispatcher#133 and #62.
Calls the shared workflow from codehaus-plexus/.github#62, so the organisation site can be published from the Actions tab rather than by a maintainer running 'mvn site-deploy' locally. This site is served from the master branch, not gh-pages, because it is an organisation page. That target comes from scmBranch in this POM; the shared workflow leaves the branch to the POM rather than forcing gh-pages, which is codehaus-plexus/.github#65. Part of codehaus-plexus/.github#58
Calls the shared workflow added in codehaus-plexus/.github#62, so the site can be published from the Actions tab instead of from a maintainer's laptop. Single-module project, so no multi-module input: the POM binds scm-publish to site-deploy already. Exposes dry-run so the first publish here can be verified without committing to gh-pages. Part of codehaus-plexus/.github#58
Part of #58. The last item on the plan.
Site publishing is entirely manual today and was documented differently in six READMEs, two of which contradicted their own POM. That shows up in the
gh-pagesdates, which ranged from May 2023 to June 2026 before this effort started. This gives every project one button.Deliberately
workflow_dispatch, not release-triggeredI raised this earlier on #58 and it still seems right: publishing on release puts unreviewed content live automatically, takes the release manager out of the loop, and Maven site builds break often enough — doxia, site plugin, JDK interactions — that I would rather a person saw the output. This makes the procedure repeatable without making it unattended.
Easy to promote to release-triggered later if it proves boring.
The authentication problem, and how this solves it
The POMs derive
pubScmUrlfromscm.developerConnection, which is:An ssh URL cannot authenticate with the job token, so the plugin would fail. The workflow overrides it to https and supplies the credential through a git rewrite rule:
git config --global "url.https://x-access-token:${GH_TOKEN}@github.com/.insteadOf" "https://github.com/"That keeps the token out of the command line and the process list, which passing
-Dscmpublish.pubScmUrl=https://token@…would not. Checkout runs withpersist-credentials: false.No new secret is needed —
permissions: contents: writeon the job is enough for the token to push to that repository's owngh-pages.Handles both project layouts
contentsite-deploytarget/site, set in each POMsite site:stage scm-publish:publish-scmtarget/staging— the plugin defaultI checked the plugin descriptor rather than assuming:
contentdefaults to${project.build.directory}/staging, which is exactly whatsite:stageproduces. So themulti-moduleinput switches goals and needs no other configuration.Property names are from the plugin descriptor too —
scmpublish.pubScmUrl,scmpublish.scm.branch,scmpublish.content,scmpublish.dryRun.dry-runBuilds the site and checks out
gh-pageswithout committing or pushing. The first use of this in any repository should be a dry run.Concurrency
cancel-in-progress: false, grouped per repository. Two concurrent runs would race ongh-pages, and cancelling one mid-push is worse than queueing.Callers come next
Once this merges, each repository needs a small caller. I'll do two first so the shape can be reviewed before the sweep:
and for the multi-module ones:
That is
modello,plexus-compiler,plexus-languagesandplexus-interactivity.Note this cannot be end-to-end tested until it is on
master, sinceworkflow_callresolves against a ref — which is the other reason for thedry-runinput.