Skip to main content

GitHub Workflows

This repository uses three automated workflows for CI/CD and content management.


1. Continuous Deployment (cd.yml)​

Trigger: Push to main or preview

Purpose: Build the Docker image and deploy it. A push to main updates abair.ie, and a push to preview updates preview.abair.ie.

Both jobs run on the organisation's self-hosted runner (on the docker-build VM), in the prod environment.

Steps:

  1. Build and push the image

    • Builds the Dockerfile, passing the build-time variables as build args (see Environment Variables)
    • Pushes to the internal registry as 10.0.0.12:5000/abair_website, tagged :main or :preview after the branch
    • There's no login step: the runner is already logged in to the registry (set up by setup-docker-build.yml in infrastructure-automation)
  2. Deploy to services-user

    • Connects as deploy@10.0.0.18 and runs docker compose pull && docker compose up -d in /opt/apps/abair_website
    • The compose file defines both the main and preview containers, so this one step covers both. Only the container whose tag changed is recreated.

Required Configuration:

TypeNamePurpose
Variable (prod environment)NEXT_PUBLIC_SUPABASE_URLSupabase project URL
Variable (prod environment)NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEYSupabase publishable key

There are no GitHub secrets. Runtime secrets such as OPENAI_API_KEY live in the server's .env, not in CI.


2. Continuous Integration (ci.yml)​

Trigger: Pull requests to main branch

Purpose: Verify builds succeed before merging

Steps:

  1. Checkout code
  2. Setup Node.js 18.16.0
  3. 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:

  1. Verify Requester

    • Checks if the requesting user is a repository collaborator
    • Aborts if user lacks permissions
  2. Update Translation File

    • Receives file path and content via event payload
    • Creates/updates JSON translation file
  3. Commit & Push

    • Commits changes directly to main branch
    • Uses requester's username for git author
    • The push triggers cd.yml, so translation updates go straight to abair.ie

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 or preview
  • 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":{...}}'