Skip to content

Commit 0d1c978

Browse files
committed
docs: update secrets documentation for multi-environment setup
- Split secrets into Repository (shared) and Environment (per-env) - Add environment: production to deploy job - Use dummy values for E2E test secrets (not needed for testing)
1 parent e9f8df8 commit 0d1c978

2 files changed

Lines changed: 18 additions & 6 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,15 +176,16 @@ jobs:
176176
run: npm run test:e2e:run
177177
env:
178178
CI: true
179-
SESSION_SECRET: ${{ secrets.SESSION_SECRET }}
180-
MAGIC_LINK_SECRET: ${{ secrets.MAGIC_LINK_SECRET }}
179+
SESSION_SECRET: test-session-secret
180+
MAGIC_LINK_SECRET: test-magic-link-secret
181181
MAILGUN_SENDING_KEY: nothing
182182
MAILGUN_DOMAIN: nothing
183183

184184
deploy:
185185
name: Deploy to production
186186
runs-on: ubuntu-latest
187187
needs: [lint, type-check, unit-test, e2e-test]
188+
environment: production
188189
# Only run on push to main (not on PRs)
189190
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
190191

docs/deployment.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,29 @@ Deployment is automated via GitHub Actions:
2222

2323
## Required GitHub Secrets
2424

25-
Configure these secrets in your repository settings
26-
(`Settings > Secrets and variables > Actions`):
25+
Configure secrets in `Settings > Secrets and variables > Actions`.
26+
27+
### Repository Secrets (shared across environments)
2728

2829
| Secret | Description |
2930
| ------------------------- | -------------------------------------------------------- |
3031
| `SSH_PRIVATE_KEY` | SSH private key for accessing the VPS |
3132
| `KAMAL_REGISTRY_PASSWORD` | GitHub Personal Access Token with `write:packages` scope |
32-
| `SESSION_SECRET` | Session encryption secret |
33-
| `MAGIC_LINK_SECRET` | Magic link email authentication secret |
3433
| `MAILGUN_SENDING_KEY` | Mailgun API key for sending emails |
3534
| `MAILGUN_DOMAIN` | Mailgun domain (e.g., `mg.rumahberbagi.com`) |
3635

36+
### Environment Secrets (per environment)
37+
38+
Create two environments: `production` and `staging` in
39+
`Settings > Environments`. Add these secrets to each:
40+
41+
| Secret | Description |
42+
| ------------------- | -------------------------------------- |
43+
| `SESSION_SECRET` | Session encryption secret |
44+
| `MAGIC_LINK_SECRET` | Magic link email authentication secret |
45+
46+
**Note:** Use different values for each environment to isolate auth tokens.
47+
3748
### SSH Key Setup
3849

3950
1. Generate an SSH key pair (if not already done):

0 commit comments

Comments
 (0)