Skip to content

ci: add publish workflow (build, scan, push without deploy) and call it from cd - #7

Merged
anwar3606 merged 2 commits into
devfrom
chore/OP-271-publish-workflow
Oct 30, 2026
Merged

anwar3606 merged 2 commits into
devfrom
chore/OP-271-publish-workflow

Conversation

@anwar3606

@anwar3606 anwar3606 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Adds publish.yml, which builds, scans and pushes the service image to ECR without deploying it, and makes cd.yml call it.

Ticket: OP-271

Why

cd.yml was the only way to push an image, and it always deployed. Building an image of a branch for local or ephemeral-cell testing meant deploying that branch to shared DEV.

What changes

  • publish.yml (new): setup → check-image → build → vulnerability-scan → tag-push, the same jobs and helper workflows cd.yml used. Triggers: workflow_dispatch (inputs REPO_REF, AWS_ENV, UUID) and workflow_call. Outputs COMMIT_SHA and RELEASE_VERSION.
  • cd.yml: preflight → publish → set-version → deploy.
    • preflight is the shared deploy-freeze check (preflight-deploy.yml), so an active freeze now also skips the build.
    • Unchanged: triggers, [no-deploy], dispatch inputs, the UUID run name used by deploy-origin, v* release tagging and retag-existing.
  • cd.yml builds pull_request.merge_commit_sha on a merged PR, so a run that starts late cannot pick up a later merge from the base branch.
  • publish.yml reads REPO_REF from env in its setup script instead of interpolating it into shell.
  • build.yml: brought to the standard shape. Takes REPO_REF, builds with buildx, the ECR mirror and the registry cache, and names the tarball and artifact after the built commit, which is what vulnerability-scan and tag-push look up. publish.yml adds the check-image and vulnerability-scan steps this repo did not run.

Build an image of your branch

Actions → Publish → Run workflow:

  • Your branch already has publish.yml (created or rebased after this merge): pick it in Use workflow from and leave every field as is.
  • Your branch is older, or you want a tag or commit: keep Use workflow from on the default branch and put the branch, tag or SHA in REPO_REF.

The image is pushed to dev ECR as <repo>:<first 7 characters of the commit SHA>. Nothing is deployed.

Checks

  • actionlint passes on the changed workflows.
  • The same cd.yml → publish.yml chain ran on origin-l10n-svc after #88 merged: preflight, setup, check-image, build, tag and push to ECR all succeeded.

…out deploying

cd.yml now runs the deploy-freeze preflight, calls publish.yml, then
set-version and deploy. publish.yml can also be dispatched on its own
to push <repo>:<sha7> to ECR for any branch without changing what is
deployed.

Refs OP-271
Copilot AI balanced review requested due to automatic review settings October 30, 2026 12:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The workflows can deploy dev instead of the selected revision and publish images even when vulnerability scanning fails.

2 open issues
What changed in this PR

Separates image publishing from deployment so branches can be built and pushed to ECR for testing without changing shared DEV.

Changes:

  • Adds a standalone, reusable publish workflow with image-existence checks, builds, vulnerability scanning, and pushing.
  • Refactors CD to run a deploy-freeze check before publishing, setting the version, and deploying.
  • Updates builds to use explicit refs, Buildx, ECR mirrors, registry caching, and commit-based artifact names.
File Description
.github/​workflows/​publish.yml Adds image publishing without deployment.
.github/​workflows/​cd.yml Delegates publishing and adds the preflight deployment check.
.github/​workflows/​build.yml Adds ref selection, cached Buildx builds, and commit-based artifacts.

Review effort: Balanced

Comment thread .github/workflows/cd.yml Resolved
Comment thread .github/workflows/publish.yml Resolved
…ia env

- Dispatch form hints: REPO_REF is optional and defaults to the branch
  picked in "Use workflow from"; UUID is for automation only.
- cd.yml passes pull_request.merge_commit_sha so a merged-PR run builds
  the commit that PR produced, not whatever the base branch points at
  when the run starts.
- publish.yml reads REPO_REF from env in the setup script instead of
  interpolating it into shell.

Refs OP-271
Copilot AI balanced review requested due to automatic review settings October 30, 2026 12:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Image publication is not gated on successful vulnerability scanning, and missing caller permissions can cause reusable workflow calls to fail before building.

2 open issues
1 resolved since last review

Review effort: Balanced

name: ${{ github.job.name }}
runs-on: ${{ vars.RUNNER_TYPE }}
permissions:
id-token: write
@anwar3606
anwar3606 marked this pull request as ready for review October 30, 2026 13:17
@anwar3606
anwar3606 merged commit edf2000 into dev Oct 30, 2026
1 check passed
@anwar3606
anwar3606 deleted the chore/OP-271-publish-workflow branch November 2, 2026 15:35
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.

2 participants