Skip to content

Split build-and-distribute into resolve, build, and package jobs - #322

Open
Biont wants to merge 3 commits into
fix/build-fingerprintfrom
refactor/build-distribute-jobs
Open

Biont wants to merge 3 commits into
fix/build-fingerprintfrom
refactor/build-distribute-jobs

Conversation

@Biont

@Biont Biont commented Dec 2, 2026

Copy link
Copy Markdown
Member

Stacked on #321. Review and merge that one first.

Why

After the fingerprint change, a cache hit still flowed through a single job in which 13 steps carried an env.SKIP_BUILD != 'true' condition. This PR replaces those step conditions with a single job-level condition.

Changes

  • resolve: determines the package version and build branch, validates the branch strategy, computes the fingerprint, and searches the build branch history. It outputs build-commit on a hit.
  • build: runs only on a miss (if: needs.resolve.outputs.build-commit == ''). Same steps as before, with no SKIP_BUILD conditions.
  • package: checks out the build commit (fresh or reused), stages it, and uploads the artifact. It sets the artifact and build-commit workflow outputs.
  • Concurrency moves to the workflow level and is keyed on the build branch only (previously job-level, SHA + branch):
    • A job-level lock no longer covers lookup → build → push once these span several jobs.
    • The lock protects the build branch, which all runs on the push path write to, so the branch is the right key.
    • This also fixes a pre-existing race: two different commits pushed to the same build branch in quick succession were not serialized, and the slower push failed as non-fast-forward.

Behaviour changes

  • The artifact contains exactly the committed files on both paths. Previously a fresh build zipped the working tree, which could include git-ignored leftovers (e.g. node_modules without a .distignore), while a reused build didn't.
  • ENV_VARS is applied in the build job only, so it no longer affects version detection.
  • A newly queued run cancels a pending run for the same build branch (GitHub keeps one pending run per group). Intermediate commits during rapid pushes may not be built.
    • ⚠️ A pending release run is cancelled too if a dev push to the same branch is queued after it. It shows as cancelled and has to be re-run.
  • Two more runner startups per run (roughly 10–20 s).
  • The concurrency group uses the origin branch name (e.g. dev/main) unless BUILT_BRANCH_NAME is set, because expressions can't strip the dev/ prefix.

Reviewing

Most of the diff is moved code:

git diff -w --color-moved=dimmed-zebra fix/build-fingerprint refactor/build-distribute-jobs

Testing

  • YAML validated locally.
  • Not yet run on GitHub Actions, and actionlint has not been run locally.

Replaces the SKIP_BUILD condition on every build step with a job-level
condition: `resolve` computes the version, build branch, and fingerprint
and looks up an existing build; `build` only runs on a miss; `package`
uploads the build commit either way.

The concurrency lock moves to the workflow level and is keyed on the build
branch only, so lookup, build, and push stay serialized across jobs. This
also fixes a pre-existing race where two different commits pushed to the
same build branch concurrently.

Behaviour changes:
- The artifact is created from the build commit, so it contains exactly the
  committed files on both the fresh and the reused path.
- ENV_VARS are applied in the build job only.
- A newly queued run cancels a pending run for the same build branch.
@Biont
Biont requested a review from a team as a code owner December 2, 2026 16:24
Biont added 2 commits December 2, 2026 17:44
# Conflicts:
#	.github/workflows/build-and-distribute.yml
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