You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
migrate image tags from docker-compose.yaml to .env
Move BACKEND_TAG/FRONTEND_TAG into a co-located .env file that Docker
Compose loads automatically. CI now uses source/sed instead of yq for
tag operations, eliminating the yq dependency from all workflows except
lint-yaml. Rename the reusable workflow input from composePath to envPath.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .claude/CLAUDE.md
+5-4Lines changed: 5 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,14 +17,14 @@ Ready-to-use workflow files are in [`templates/gitops-ci/`](./templates/gitops-c
17
17
18
18
## Demo
19
19
20
-
The `demo/` directory is a filled-in copy of the templates using `ghcr.io/aquasecurity/trivy` (public image with many semver tags). Backend pinned to `0.24.0`, frontend to `0.23.0` — deliberately old so tag discovery always finds a diff. See [demo/README.md](./demo/README.md).
20
+
The `demo/` directory is a filled-in copy of the templates using `ghcr.io/aquasecurity/trivy` (public image with many semver tags). Backend pinned to `0.24.0`, frontend to `0.23.0`in `.env`— deliberately old so tag discovery always finds a diff. See [demo/README.md](./demo/README.md).
21
21
22
22
The `.github/` directory contains the same demo workflows configured to actually run on this repo (cron disabled, deployment is echo-only).
23
23
24
24
## CI & Testing
25
25
26
26
-**CI dry-run** (`.github/workflows/ci-dryrun.yaml`) — 5 parallel jobs: lint-yaml, lint-shell, version extraction, GHCR tag discovery, release PR dry-run. Runs on push to main and PRs.
27
-
-**Local smoke test** (`test/smoke.sh`) — validates YAML, version extraction, semver regex, shellcheck, and placeholder replacement. Requires `yq` and `shellcheck` (gracefully skips if missing).
27
+
-**Local smoke test** (`test/smoke.sh`) — validates YAML, `.env` file, version extraction, semver regex, shellcheck, and placeholder replacement. Requires `shellcheck` (gracefully skips if missing); `yq` needed only for YAML validation.
28
28
-**Manual triggers** — all workflows support `workflow_dispatch` for on-demand testing.
29
29
30
30
## Key Patterns
@@ -35,16 +35,17 @@ The `.github/` directory contains the same demo workflows configured to actually
35
35
4.**GHCR tag discovery** — Custom composite action that paginates the GHCR API, exchanges tokens for cross-org access, and filters by semver.
36
36
5.**Auto-merge with retry** — `peter-evans/create-pull-request` + `nick-fields/retry` to handle branch protection race conditions.
37
37
6.**Scheduled run cleanup** — Deletes old successful cron runs to keep the Actions tab clean.
38
-
7.**Slack notifications** — Reports deployed versions extracted from `docker-compose.yaml`.
38
+
7.**Slack notifications** — Reports deployed versions extracted from `.env`.
39
39
40
40
## Gotchas
41
41
42
42
-`env` context is **not available** in `with:` for reusable workflow calls — values must be inlined.
43
43
-`GITHUB_TOKEN` cannot read packages from other orgs — the ghcr-latest-tag action exchanges it for a GHCR-scoped token.
44
44
- The default tag pattern is strict semver (`X.Y.Z`) to exclude arch-specific tags like `0.25.2-s390x`.
45
+
- Image tags live in `.env` (not `docker-compose.yaml`). Docker Compose auto-loads `.env` from the same directory.
45
46
46
47
## Applying to Monorepos
47
48
48
49
- Use `paths` filters to only build/deploy what changed
49
50
- Combine with `turbo run build --filter=...[origin/main]` for Turborepo change detection
50
-
- Call the reusable workflow multiple times with different `baseBranch`/`composePath` for staging vs production
51
+
- Call the reusable workflow multiple times with different `baseBranch`/`envPath` for staging vs production
Copy file name to clipboardExpand all lines: README.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# GitOps CI/CD Patterns
2
2
3
-
Reusable GitHub Actions templates for automated GitOps deployments. Polls GHCR for new image tags, creates PRs to update `docker-compose.yaml`, and deploys on merge.
3
+
Reusable GitHub Actions templates for automated GitOps deployments. Polls GHCR for new image tags, creates PRs to update a `.env` file (consumed by `docker-compose.yaml`), and deploys on merge.
4
4
5
5
## Structure
6
6
@@ -19,13 +19,14 @@ test/smoke.sh # Local validation script
See the [template README](./templates/gitops-ci/README.md) for full setup instructions.
25
26
26
27
## Demo
27
28
28
-
The `demo/` directory is a working example using [`ghcr.io/aquasecurity/trivy`](https://github.com/aquasecurity/trivy/pkgs/container/trivy) — a public image with many semver tags. Backend pinned to `0.24.0`, frontend to `0.23.0` so tag discovery always finds newer versions.
29
+
The `demo/` directory is a working example using [`ghcr.io/aquasecurity/trivy`](https://github.com/aquasecurity/trivy/pkgs/container/trivy) — a public image with many semver tags. Backend pinned to `0.24.0`, frontend to `0.23.0`in `.env`so tag discovery always finds newer versions.
29
30
30
31
The `.github/` directory runs the same demo workflows on this repo (cron disabled, deployment is echo-only). Trigger manually:
31
32
@@ -49,7 +50,7 @@ CI runs automatically on push to main and PRs with 5 parallel validation jobs.
49
50
## How It Works
50
51
51
52
1.**Trigger** — Polls GHCR on a schedule for the latest semver image tags
52
-
2.**PR Creation** — Compares with current `docker-compose.yaml`, creates a PR if versions differ
53
+
2.**PR Creation** — Compares with current `.env` file, creates a PR if versions differ
53
54
3.**Deployment** — Merging the PR triggers deployment to the target server
54
55
55
56
Three deployment strategies: EC2/AWS, SSH, or self-hosted runner.
0 commit comments