c930f64e78e673885cf54bf70ad0d86e3fe27485
Resuely CI Actions
Shared CI building blocks for Resuely repositories running on Gitea Actions.
This repo centralizes deployment automation so each application repo only needs a thin workflow wrapper.
What this repo provides
build-push-bump
Path: .github/actions/build-push-bump/action.yml
Builds and pushes a Docker image to the Gitea registry and then bumps a variable in resuely/infra (GitOps style) to trigger a production deploy.
Flow:
- Compute a unique image tag:
<shortsha>-<unix_timestamp> docker loginto the Gitea registrydocker buildanddocker pushthe image- Clone the infra repo, update
stack.env, commit, and push tomain
This keeps production state versioned in the infra repo while allowing fast iteration on every push.
Requirements
- Gitea Actions runner capable of running Docker commands.
- The target registry must be reachable from the runner.
- A bot account/token with write access to the infra repo.
Usage
In an application repo, create .github/workflows/deploy.yaml like this:
name: Build & Deploy (prod)
"on":
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build, push, bump infra
uses: https://git.rlugo.dev/resuely/ci-actions/.github/actions/build-push-bump@main
with:
registry: git.rlugo.dev
image: git.rlugo.dev/resuely/handy
infraRepo: git.rlugo.dev/resuely/infra.git
stackEnvPath: stacks/resuely/prod/stack.env
stackEnvKey: HANDY_IMAGE_TAG
registryUsername: ${{ secrets.REGISTRY_USERNAME }}
registryToken: ${{ secrets.REGISTRY_TOKEN }}
infraPushToken: ${{ secrets.INFRA_PUSH_TOKEN }}
Inputs
Required
-
registry- Registry host.
- Example:
git.rlugo.dev
-
image- Full image name without tag.
- Example:
git.rlugo.dev/resuely/auth
-
infraRepo- HTTPS clone URL (no credentials in the value).
- Example:
git.rlugo.dev/resuely/infra.git
-
stackEnvPath- Path inside infra repo to the env file that holds image tags.
- Example:
stacks/resuely/prod/stack.env
-
stackEnvKey- The variable name inside
stack.envto bump. - Examples:
AUTH_IMAGE_TAG,HANDY_IMAGE_TAG
- The variable name inside
-
registryUsername- Username used for
docker login.
- Username used for
-
registryToken- Token/password used for
docker login.
- Token/password used for
-
infraPushToken- Token with write access to
resuely/infra. - The action uses the username
resuely-botwhen cloning/pushing.
- Token with write access to
Outputs
tag- The computed tag that was pushed.
Secrets to configure (recommended)
In each application repo:
REGISTRY_USERNAMEREGISTRY_TOKENINFRA_PUSH_TOKEN
Notes and best practices
- This action tags images immutably (
<sha>-<timestamp>). The infra repo decides what is running. - Production secrets should not live in
resuely/infra. Keep them on the server (e.g./srv/resuely/secrets/*.env). - Rollback is a
git revertinresuely/infra(or manually setting the image tag back).
Troubleshooting
-
Action fetch fails:
- Ensure Gitea Actions is configured to allow fetching actions from your instance.
- Prefer the absolute
uses: https://...URL (supported by Gitea) to avoid default action URL restrictions.
-
Push to infra fails:
- Confirm
INFRA_PUSH_TOKENhas write permission toresuely/infra. - Confirm the bot user exists (or adjust the clone URL username in the action).
- Confirm
-
Docker login fails:
- Verify
REGISTRY_USERNAME/REGISTRY_TOKENand that the token has package push access.
- Verify
Description