From 47fed0b880afb67c2c7142aafbb762c0a20249cb Mon Sep 17 00:00:00 2001 From: Frank John Begornia Date: Thu, 27 Nov 2025 00:12:35 +0800 Subject: [PATCH] ci: support trunk-based workflow with feat/fix branches --- .github/workflows/docker-publish.yml | 5 ++- GHCR-AUTH.md | 65 ++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 GHCR-AUTH.md diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 72443f1..e8bb18d 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -4,12 +4,15 @@ on: push: branches: - main - - develop + - dev + - 'feat/**' + - 'fix/**' tags: - 'v*' pull_request: branches: - main + - dev env: REGISTRY: ghcr.io diff --git a/GHCR-AUTH.md b/GHCR-AUTH.md new file mode 100644 index 0000000..8460195 --- /dev/null +++ b/GHCR-AUTH.md @@ -0,0 +1,65 @@ +# Login to GitHub Container Registry (GHCR) + +## On the Server + +### 1. Create GitHub Personal Access Token +Go to: https://github.com/settings/tokens + +Click "Generate new token (classic)" + +Select scopes: +- ✅ `read:packages` (required) +- ✅ `write:packages` (if you need to push) + +Copy the token (starts with `ghp_`) + +### 2. Login to GHCR + +```bash +# On your server +echo YOUR_GITHUB_TOKEN | docker login ghcr.io -u franknstayn --password-stdin +``` + +Or export as environment variable: + +```bash +export GITHUB_TOKEN=ghp_your_token_here +echo $GITHUB_TOKEN | docker login ghcr.io -u franknstayn --password-stdin +``` + +### 3. Pull the image + +```bash +cd crew-infrastructure +docker compose pull slipmatz_web +docker compose up -d slipmatz_web +``` + +## Make Package Public (Alternative - No Auth Required) + +If you want to avoid authentication: + +1. Go to: https://github.com/franknstayn?tab=packages +2. Click on `slipmatz-web` package +3. Package settings (right sidebar) +4. "Change visibility" → Select "Public" +5. Confirm + +Then you can pull without login: +```bash +docker compose pull slipmatz_web +``` + +## Recommended for Production + +Store credentials securely: + +```bash +# On server, add to ~/.bashrc or ~/.zshrc +export GITHUB_TOKEN=ghp_your_token_here + +# Add to docker-compose.yml env +echo "GITHUB_TOKEN=$GITHUB_TOKEN" >> .env +``` + +Or use docker credential helper for permanent storage.