Files
eric 248eb37110 feat: support custom tag-keys for non-standard YAML layouts
Adds tag-keys input (comma-separated) to update arbitrary YAML keys
instead of just 'tag'. Handles unquoted values, quoted values, and
YAML anchors (e.g. rustImageTag: &rustImageTag "value").

Makes image-repository optional when using custom tag-keys.
2026-06-17 20:06:59 -07:00

49 lines
1.9 KiB
Markdown

# actions-k8s
Reusable Gitea Actions for Kubernetes deployments.
## `flux-deploy`
Update a Flux HelmRelease image tag in a GitOps repo to trigger a Kubernetes deployment.
### Usage (standard bjw-s app-template)
```yaml
- name: Deploy to K8s via Flux
uses: https://git.ericxliu.me/eric/actions-k8s/.gitea/actions/flux-deploy@main
with:
image-repository: git.ericxliu.me/eric/my-app
image-tag: ${{ steps.build.outputs.tag }}
gitops-file: apps/myapp/my-app/release.yaml
deploy-key: ${{ secrets.K8S_FLUX_DEPLOY_KEY }}
```
### Usage (custom tag keys — e.g. YAML anchors)
For non-standard layouts where image tags are stored in custom keys
(e.g. `rustImageTag: &rustImageTag "2026-06-17-abc1234"`):
```yaml
- name: Deploy to K8s via Flux
uses: https://git.ericxliu.me/eric/actions-k8s/.gitea/actions/flux-deploy@main
with:
image-tag: ${{ env.TAG }}
tag-keys: rustImageTag,uiImageTag
gitops-file: apps/myapp/stock-analyzer/release.yaml
deploy-key: ${{ secrets.K8S_FLUX_DEPLOY_KEY }}
```
### Inputs
| Input | Required | Default | Description |
|---|---|---|---|
| `image-repository` | No | `""` | Full image repository to set in `repository:` fields. Optional when using `tag-keys`. |
| `image-tag` | **Yes** | — | Image tag to deploy |
| `tag-keys` | No | `tag` | Comma-separated YAML keys to update. Handles unquoted, quoted, and YAML anchor formats. |
| `gitops-repo` | No | `git@github.com:eric-x-liu/k8s-flux.git` | SSH URL of the GitOps repo |
| `gitops-file` | **Yes** | — | Path to the release YAML in the GitOps repo |
| `deploy-key` | **Yes** | — | SSH private key with push access to the GitOps repo |
| `git-user-name` | No | `gitops-ci` | Git commit author name |
| `git-user-email` | No | `gitops-ci@users.noreply.git.ericxliu.me` | Git commit author email |
| `commit-message` | No | `Update {app} image to {tag}` | Custom commit message with `{app}` and `{tag}` placeholders |