ci: support trunk-based workflow with feat/fix branches

This commit is contained in:
Frank John Begornia
2025-11-27 00:12:35 +08:00
parent 562e66d3ce
commit 47fed0b880
2 changed files with 69 additions and 1 deletions

View File

@@ -4,12 +4,15 @@ on:
push:
branches:
- main
- develop
- dev
- 'feat/**'
- 'fix/**'
tags:
- 'v*'
pull_request:
branches:
- main
- dev
env:
REGISTRY: ghcr.io

65
GHCR-AUTH.md Normal file
View File

@@ -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.