ci: upgrade to github-workflows v2.0.0 (set-image-tags, sync-env pin)#110
Conversation
…ariable, and update related scripts
There was a problem hiding this comment.
Pull request overview
This PR upgrades the repository’s GitHub Actions integrations to BehindTheMusicTree/github-workflows@v2.0.0, removes the legacy REDEPLOYMENT_ROOT variable in favor of the new image-tag pool directory variable, and updates the release tooling/docs accordingly.
Changes:
- Update
publish.ymlto useset-image-tags-on-server.yml@v2.0.0(single call for API/DB/AFP tags) and pin redeploy webhook to@v2.0.0; replaceREDEPLOYMENT_ROOTwithIMAGE_TAGS_POOL_DIR. - Update
sync-env-to-server.ymlto pin the shared workflow to@v2.0.0and removeREDEPLOYMENT_ROOTfrom fragment-building validation. - Update release tooling to automatically remove prerelease/dev tags after bumping, and document workflow changes in the changelog/docs.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/prepare_release_bump.py |
Adds a post-bump step to run remove_prerelease_tags.sh. |
docs/workflows.md |
Removes REDEPLOYMENT_ROOT mention in sync/publish documentation (but needs further updates for publish section accuracy). |
CHANGELOG.md |
Records the workflow v2.0.0 upgrade and release-script change under Unreleased. |
.github/workflows/sync-env-to-server.yml |
Removes REDEPLOYMENT_ROOT from required vars and pins reusable workflow calls to @v2.0.0. |
.github/workflows/publish.yml |
Switches from per-app tag setting to a single stack-based image-tag setting call; replaces REDEPLOYMENT_ROOT with IMAGE_TAGS_POOL_DIR; pins redeploy workflow to v2.0.0. |
.github/actionlint.yaml |
Removes REDEPLOYMENT_ROOT from the actionlint allowlist (but needs IMAGE_TAGS_POOL_DIR added). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - GHCR_IMAGE_NAMESPACE | ||
| - HTMT_API_IMAGE_REPO | ||
| - AFP_VERSION | ||
| - STATIC_FILES | ||
| - STATIC_FILES_URL | ||
| - SERVER_HOST | ||
| - REDEPLOYMENT_ROOT | ||
| - BTMT_REDEPLOYMENT_HOOK_ID_BASE | ||
| - DEMO_EMAIL |
| 1. **determine-version** – from ref: tag with `-` → TEST; tag without `-` → PROD; `main` (e.g. manual dispatch) → staging + TEST | ||
| 2. **static** – calls `static-files.yml`, commits and pushes collected static files | ||
| 3. **build-and-push** – calls `build-and-push.yml` with commit hash and **environment** (TEST or PROD) | ||
| 4. **check-pinned-tags** – requires **`AFP_VERSION`** in Settings → Variables (no `latest`); DB image is **`postgres:16.4`** (fixed in [`docker-compose.yml`](../docker-compose.yml); publish sets server DB tag **`16.4`**) | ||
| 5. **set-version-api** / **set-version-db** / **set-version-afp** – shared workflows from `BehindTheMusicTree/github-workflows` | ||
| 6. **redeploy-webhook-call** – **`hook_id_base`** from **`check-pinned-tags`** (**`BTMT_REDEPLOYMENT_HOOK_ID_BASE`** validated under **Environment** **`STAGING`** / **`PROD`** there). Caller job is **`uses:`** only—**`environment`** is not allowed on that job shape in the Actions schema, so **`secrets: inherit`** supplies **repo/org** secrets (e.g. **`BTMT_REDEPLOYMENT_WEBHOOK_SECRET_*`**). Environment-only webhook secrets need a repo/org copy or support inside **`call-redeployment-webhook`**. Pinned **`@v1.0.4`**. | ||
|
|
||
| **Environment:** **TEST** for prerelease/dev tags and for manual runs from `main` (staging). **PROD** for release tags (production). DB and AFP image tags must be pinned in repo variables. | ||
|
|
||
| **Variables (org-level pool, same as Sync env):** `REDEPLOYMENT_ROOT` (e.g. `/var/webhook/redeployment`). Set once at the **organization** (Settings → Variables) so the infrastructure repo and all app repos that call set-image-tag-on-server use the same path. If unset, the tag file path is wrong and the step fails. | ||
|
|
||
| **Versioning:** Manual dispatch from `main` uses `VERSION` file and image tag `staging`. Tag push uses tag version; `workflow_call` without a tag uses latest git tag. |
There was a problem hiding this comment.
@copilot apply changes based on this feedback
There was a problem hiding this comment.
Applied in commit 84b9035. I updated docs/workflows.md so the Publish section now matches publish.yml (uses set-image-tags, call-redeployment-webhook@v2.0.0, and includes IMAGE_TAGS_POOL_DIR as a required STAGING/PROD environment variable).
Agent-Logs-Url: https://github.com/BehindTheMusicTree/hear-the-music-tree-api/sessions/e800fbc0-4b36-4016-8020-b7510ca99b84 Co-authored-by: Andreas-Garcia <5967215+Andreas-Garcia@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. |
Test Results1 113 tests 1 109 ✅ 10m 40s ⏱️ Results for commit 84b9035. |
Description
Upgrades both publish and sync-env workflows to
BehindTheMusicTree/github-workflows@v2.0.0, adopting the new atomicset-image-tags-on-serverworkflow and removing the obsoleteREDEPLOYMENT_ROOTvariable.Related Issue
N/A
Type of Change
Target Branch
develop(for features, bug fixes, chores, dependency updates from Dependabot)main(for hotfixes only)Changes Made
.github/workflows/publish.ymlset-image-tag-on-server.yml@maincalls (API, DB, AFP) with a singleset-image-tags-on-server.yml@v2.0.0job usingstack: btmtand a multilinetagsblock (HTMT_API_TAG,DB_TAG=16.4,AFP_TAG) plusrelease_id/release_shametadatacheck-pinned-tags: replacedREDEPLOYMENT_ROOT,HTMT_API_APP_NAME,DB_APP_NAME_SUFFIX,AFP_APP_NAMEenv/validation withIMAGE_TAGS_POOL_DIRredeploy-webhook-call: pinned from@v1.0.4→@v2.0.0; depends onset-image-tagsinstead of the three old jobs.github/workflows/sync-env-to-server.ymlREDEPLOYMENT_ROOTfrom both fragment-building job env blocks andrequiredvar checks (no longer aworkflow_callinput in v2.0.0)@main→@v2.0.0Testing
Publish workflow triggered on a prerelease tag —
set-image-tagsjob wrotebtmt-staging.tags.envon the server successfully after manually creatingIMAGE_TAGS_POOL_DIR(mkdir -p /srv/btmt/image-tags).Test commands:
# No automated tests for workflow changes — validate via GitHub Actions runChecklist
Code Quality
Tests
pytestDocumentation
[Unreleased]sectionGit Hygiene
<type>(<scope>): <summary>feature/,chore/,dependabot/,hotfix/,release/)Breaking Changes
Breaking Changes:
REDEPLOYMENT_ROOTGitHub Variable is no longer used and should be removed from STAGING/PROD environmentsAFP_APP_NAMEGitHub Variable is no longer used bypublish.ymland can be removedIMAGE_TAGS_POOL_DIR(e.g./srv/btmt/image-tags) must be added to STAGING and PROD GitHub Environments before mergingIMAGE_TAGS_POOL_DIRmust exist on the server (mkdir -p /srv/btmt/image-tags)Additional Notes
The v2.0.0
set-image-tags-on-serverworkflow writes a single atomic manifest file per stack/env (<stack>-<env>.tags.env) rather than one file per service, aligning with how the infrastructure redeploy script reads image tags.