Skip to content

ci: align release workflow with service-hub container release#2

Open
djwmarcx wants to merge 4 commits into
mainfrom
ci/release-workflow
Open

ci: align release workflow with service-hub container release#2
djwmarcx wants to merge 4 commits into
mainfrom
ci/release-workflow

Conversation

@djwmarcx

Copy link
Copy Markdown
Member

Renames the docker-publish workflow to release and rewrites it to follow the same pattern as home-assistant/service-hub, adapted for web-api.

What changed

  • Trigger: now release: [published] only (was push to main / tags / PRs). Combined with the existing release-please setup, releases are automatic: merge the release PR → release-please publishes the GitHub Release → this workflow builds, pushes, and deploys.
  • Build & push: single image tag ghcr.io/OpenHomeFoundation/web-api:<version> to GHCR.
  • version.json: stamps the image with commit hash + release version.
  • Deploy: updates the Terraform Cloud variable set to roll out the new version.
  • Hardening: actions pinned to commit SHAs; concurrency group added; login uses github.repository_owner.

Deviations from the reference

  • Uses $GITHUB_OUTPUT instead of the deprecated ::set-output command.
  • Image name is web-api.

Security hardening

Avoids GitHub Actions injection: github.ref and secrets are passed via env vars (not ${{ }} shell interpolation), the release tag is validated against strict semver (vX.Y.Z), and the Terraform payload is built with jq.

Requires

  • TERRAFORM_CLOUD_TOKEN and TERRAFORM_CLOUD_VARSET_ID secrets in the repo/org.

Note: the old branch/PR/sha/latest dev-image builds are removed.

djwmarcx added 4 commits June 18, 2026 11:10
Rename docker-publish workflow to release and rewrite it to trigger on
release publication (driven by release-please), build and push the
container image to ghcr.io, stamp version.json, and trigger a Terraform
Cloud deploy via the variable set.

Harden against workflow injection: pass github.ref and secrets through
env vars, validate the release tag as strict semver, and build the
Terraform payload with jq.
Pin every GitHub Action to a commit SHA and bump to the latest release:
- googleapis/release-please-action v4 -> v5.0.0
- actions/checkout v6.0.2 -> v6.0.3
- docker/login-action v4.1.0 -> v4.2.0
- docker/build-push-action v7.0.0 -> v7.2.0
After updating the web_api_version variable set, trigger a Terraform
Cloud run on the web-api workspace with auto-apply enabled so a published
release deploys immediately instead of waiting for manual confirmation.
Look up the variable set entry by its key (web_api_image_tag) instead of
assuming it is the first variable, and fail loudly if it is missing.
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