GitHub Workflows
This repository uses three automated workflows for CI/CD and content management.
1. Continuous Deployment (cd.yml)
Trigger: Push to main branch
Purpose: Build and deploy the application to production
Steps:
-
Build Docker Image
- Uses environment variables from GitHub Secrets/Variables
- Passes build args:
OPENAI_API_KEY,NEXT_PUBLIC_SUPABASE_URL,NEXT_PUBLIC_SUPABASE_ANON_KEY - Pushes to Docker registry:
registry.abair.ie:5000
-
Deploy to Server
- SSH into production server
- Executes deployment script to pull and restart container
Required Configuration:
| Type | Name | Purpose |
|---|---|---|
| Secret | DOCKER_REGISTRY | Docker registry URL |
| Secret | DOCKER_USERNAME | Docker registry username |
| Secret | DOCKER_PASSWORD | Docker registry password |
| Secret | OPENAI_API_KEY | OpenAI API key for GPT-4o |
| Secret | HOST | Production server hostname |
| Secret | USERNAME | SSH username |
| Secret | KEY | SSH private key |
| Secret | PORT | SSH port |
| Secret | DEPLOY_SCRIPT_PATH | Path to deployment script on server |
| Variable | NEXT_PUBLIC_SUPABASE_URL | Supabase project URL |
| Variable | NEXT_PUBLIC_SUPABASE_ANON_KEY | Supabase anonymous key |
| Variable | PROJECT_NAME | Docker image name |
2. Continuous Integration (ci.yml)
Trigger: Pull requests to main branch
Purpose: Verify builds succeed before merging
Steps:
- Checkout code
- Setup Node.js 18.16.0
- Install dependencies (
npm i)
Note: Currently only validates dependency installation. No build/test steps configured.
3. Update Translations (update_translations.yml)
Trigger: Repository dispatch event with type update-translations
Purpose: Allow programmatic updates to translation files from external systems
Steps:
-
Verify Requester
- Checks if the requesting user is a repository collaborator
- Aborts if user lacks permissions
-
Update Translation File
- Receives file path and content via event payload
- Creates/updates JSON translation file
-
Commit & Push
- Commits changes directly to
mainbranch - Uses requester's username for git author
- Commits changes directly to
Event Payload Requirements:
{
"username": "github-username",
"file_path": "locales/resources.json",
"content": "{ ... JSON content ... }",
"commit_message": "Update translations"
}
Use Case: Integration with translation management systems or automated localization tools.
Workflow Execution
- cd.yml: Runs automatically on every push to
main - ci.yml: Runs automatically on all PRs targeting
main - update_translations.yml: Triggered manually via API:
curl -X POST \
-H "Authorization: token $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/OWNER/REPO/dispatches \
-d '{"event_type":"update-translations","client_payload":{...}}'