5.7 KiB
Gitea Remote and CI/CD Migration Design
Goal
Move the repository origin from GitLab to a new Gitea repository and add a Gitea Actions deployment flow that behaves like a GitHub Actions CI/CD pipeline.
Target repository:
- Gitea instance:
git.imrnes.team - Owner:
MythEclipse - Repository:
TeleUploader - SSH remote:
git@git.imrnes.team:MythEclipse/TeleUploader.git
Deployment should run automatically on pushes to main.
Current State
- Current
originpoints to GitLab:git@gitlab.com:superaseph/TeleUploader.git. - There is no existing
.github/workflowsor.gitea/workflowsdirectory. deploy.shalready implements the production deploy path:- Install dependencies.
- Format/lint/build with Bun.
- Ship the deploy context to the VPS with an SSH tar pipe.
- Build and restart the Docker Compose service on the VPS.
- Print container status/logs.
deploy.shstill contains GitLab-specific CI variable lookup throughglab.
Recommended Approach
Use deploy.sh as the single deploy entrypoint and add a thin Gitea Actions wrapper around it.
This keeps local and CI deployment behavior consistent while moving secret storage and automation from GitLab to Gitea.
Scope
In scope:
- Create the Gitea repository with
teaif it does not already exist. - Change
originto the new Gitea SSH URL. - Add
.gitea/workflows/deploy.yml. - Make
deploy.shprovider-neutral by removing GitLab/glab dependency. - Configure required Gitea Actions secrets/variables where supported by
tea. - Push
mainto Gitea after user approval.
Out of scope:
- Rewriting the deploy flow into YAML-only SSH commands.
- Changing VPS Docker Compose architecture.
- Changing app runtime configuration or production domains.
- Adding a new Gitea runner. The design assumes a working runner exists for the Gitea instance.
Workflow Behavior
The Gitea workflow should run on pushes to main:
on:
push:
branches:
- main
The workflow job should:
- Check out the repository.
- Set up Bun in the runner environment.
- Run
bun install. - Run
bun run lint. - Run
bun run build. - Write the SSH private key from a Gitea Actions secret to a temporary file.
- Export deploy environment variables.
- Run
./deploy.sh --no-build.
--no-build avoids duplicate build work because the workflow already runs lint/build before deployment.
CI Gate
The deployment gate is lint + build only.
Tests are intentionally excluded from the automatic deploy gate because this repository has tests that can rely on network, database, or mock isolation constraints. Specific tests can still be run manually when needed.
Required Gitea Actions Configuration
Required secret:
VPS_SSH_KEY: private SSH key used by the workflow to connect to the VPS.
Required variable or secret:
VPS_HOST: VPS hostname or IP.VPS_USER: SSH username, expected to berootunless changed.
The workflow can read VPS_HOST and VPS_USER from variables if Gitea Actions variables are enabled. If not, store them as secrets as well.
deploy.sh Changes
deploy.sh should no longer require GitLab or glab.
Changes:
- Remove
GITLAB_PROJECT. - Remove
fetch_ci_var(). - Update comments from GitLab CI vars to Gitea Actions secrets/variables or direct environment variables.
- Keep local defaults:
VPS_HOST=45.127.35.244VPS_USER=rootVPS_SSH_KEY=$HOME/.ssh/id_ed25519
- Preserve existing flags:
--no-build--check--help
- Preserve the existing deploy mechanism and health/status reporting.
This keeps local ./deploy.sh usage working while allowing Gitea Actions to inject CI credentials.
Repository Setup Commands
Expected implementation commands after approval:
tea repos create --owner MythEclipse --name TeleUploader --private
If the repository already exists, skip creation and use the existing remote.
Then:
git remote set-url origin git@git.imrnes.team:MythEclipse/TeleUploader.git
git push -u origin main
Before pushing, verify the local diff and ask for explicit approval if there are uncommitted changes that should be included.
Secret Setup Commands
Use tea where possible:
tea actions secrets create VPS_SSH_KEY
tea actions variables set VPS_HOST 45.127.35.244
tea actions variables set VPS_USER root
If tea actions variables is unsupported by the instance, use secrets for all three values.
Secrets that require interactive input may need the user to run the command with ! in Claude Code so the prompt is visible in this session.
Error Handling
- If
tea repos createreports the repo already exists, continue by verifying repository details and setting the remote. - If
teais not authenticated correctly, stop and ask the user to run! tea login add. - If Gitea Actions variables are unavailable, fall back to repository secrets.
- If no Gitea runner is available, repository migration can still complete, but deployment will not run until a runner is registered.
- If
git pushfails due to SSH permissions, stop and report the exact failure.
Verification
Before considering the migration ready:
- Run
./deploy.sh --checklocally to confirm deployment inputs resolve. - Run
bun run lint. - Run
bun run build. - Verify
git remote -vpoints togit@git.imrnes.team:MythEclipse/TeleUploader.git. - Verify
.gitea/workflows/deploy.ymlexists. - After push, verify Gitea can see the repository and Actions workflow.
Open Operational Assumptions
- Gitea Actions is enabled on
git.imrnes.team. - A runner capable of running Bun, SSH, tar, and shell commands is available.
- The workflow runner can reach the VPS over SSH.
- The deployment SSH key is authorized on the VPS.