Skip to content

Split the release workflow into a read-only build job and a release job - #26

Merged
pacmano1 merged 1 commit into
mainfrom
split-release-job
Oct 25, 2026
Merged

pacmano1 merged 1 commit into
mainfrom
split-release-job

Conversation

@pacmano1

Copy link
Copy Markdown
Contributor

The release workflow ran as one job that checked out, built the plugin (Maven, npm and every package they pull in) and created the draft release, so all of it ran with a token that could write to the repository. On a GitHub-hosted runner any step can read the job's token.

It's now two jobs, as in diridium-com/oie-ssh-tunnel-manager#17:

  • build runs with contents: read and keeps the token out of .git/config. It checks the versions, builds and runs the tests (no more -DskipTests), fails if no test reports were produced, and uploads the zip and its .sha256 as an artifact with actions/upload-artifact v7.0.2 (cf430e030ddbb5b0abf93d22962f4752f3646cd9, released 2026-10-07).
  • release (needs: build) holds contents: write and actions: read. It runs no checkout, no build tools and no action. gh downloads the artifact, checks it against its .sha256, refuses a tag whose release is already published, and creates the draft or replaces an existing draft's files. softprops/action-gh-release is no longer used.

The published-release check moved from the start of the old job into the release job, so it now runs after the build. Nothing else about the release changes: the draft is still unsigned, a person still signs and publishes it, and the tag is still checked against every version file. RELEASING.md says so.

Tested on a fork, pacmano1/oie-source-code-search, with immutable releases turned on and a throwaway version 0.0.1 tag on a commit whose only change from this branch sets 0.0.1 in the six version files:

  • Token permissions in the logs: build Contents: read, Metadata: read; release Actions: read, Contents: write, Metadata: read.
  • The build job ran 14 tests (3 report files) and uploaded the zip; the release job's checksum check passed.
  • It created a draft: not a prerelease, title v0.0.1, the zip and its .sha256. The zip downloaded from the draft matches its .sha256, and its plugin.xml says 0.0.1 for OIE 4.7.0.
  • A re-run built a zip with different bytes and took the other path, "A draft exists for v0.0.1; replacing its files." The draft then held the new zip, which matches its new .sha256. So with immutable releases on, a draft's files can still be replaced, which is how the signed zip goes onto the draft.

Checked locally as well: the release job's two scripts, as written in the file, ran under bash -e against a stand-in gh in seven cases, all as expected. That includes the two the fork run didn't reach: an already published release fails with nothing created or uploaded, and any other gh error fails.

Not run live: publishing a release, so the refusal of a published tag has only the stand-in test.

Co-authored with Claude Code.

The release workflow ran as one job that checked out, built the plugin
(Maven, npm and every package they pull in) and created the draft
release, so all of it ran with a token that could write to the
repository. On a GitHub-hosted runner any step can read the job's token.

Now it is two jobs, as in diridium-com/oie-ssh-tunnel-manager#17:
- build runs with contents: read and keeps the token out of .git/config.
  It checks the versions, builds and runs the tests (no more
  -DskipTests), fails if no test reports were produced, and uploads the
  zip and its .sha256 as an artifact with actions/upload-artifact v7.0.2
  (cf430e03, 2026-10-07).
- release (needs: build) holds contents: write and actions: read. It
  runs no checkout, no build tools and no action: gh downloads the
  artifact, checks it against its .sha256, refuses a tag whose release
  is already published, and creates the draft or replaces an existing
  draft's files. softprops/action-gh-release is no longer used.

The published-release check moved from the start of the old job into
the release job, so it now runs after the build. Nothing else about the
release changes: the draft is still unsigned, a person still signs and
publishes it, and the tag is still checked against every version file.
RELEASING.md says so.

Tested on a fork, pacmano1/oie-source-code-search, with immutable
releases turned on and a throwaway version 0.0.1 tag on a commit whose
only change from this one sets 0.0.1 in the six version files (run
40220314731):
- Token permissions in the logs: build Contents read, Metadata read;
  release Actions read, Contents write, Metadata read.
- The build job ran 14 tests (3 report files) and uploaded the zip; the
  release job's checksum check passed.
- It created a draft: not a prerelease, title v0.0.1, the zip and its
  .sha256. The zip downloaded from the draft matches its .sha256, and
  its plugin.xml says 0.0.1 for OIE 4.7.0.
- A re-run built a zip with different bytes and took the other path,
  "A draft exists for v0.0.1; replacing its files." The draft then held
  the new zip, which matches its new .sha256, so with immutable
  releases on a draft's files can still be replaced, which is how the
  signed zip goes onto the draft.

Checked locally as well: the release job's two scripts, as written in
the file, ran under bash -e against a stand-in gh in seven cases, all
as expected, including the two the fork run didn't reach: an already
published release fails with nothing created or uploaded, and any other
gh error fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pacmano1
pacmano1 merged commit 17b633b into main Oct 25, 2026
6 checks passed
@pacmano1
pacmano1 deleted the split-release-job branch October 25, 2026 19:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant