Skip to content

Commit a988916

Browse files
committed
feat(ci): migrate to tag-based release workflow
- Separate CI (push to main) from deployment (push tags) - CI workflow runs tests and build only - Deploy workflow triggers on version tags (v*) - Add RELEASE.md with comprehensive release process - Update README and AGENTS.md with new workflow
1 parent 1302af6 commit a988916

File tree

5 files changed

+207
-6
lines changed

5 files changed

+207
-6
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '20'
19+
20+
- name: Install dependencies
21+
run: npm install --legacy-peer-deps
22+
23+
- name: Run tests with coverage
24+
run: npm run test:coverage
25+
26+
- name: Upload coverage to Codecov
27+
uses: codecov/codecov-action@v4
28+
with:
29+
use_oidc: true
30+
files: ./coverage/coverage-final.json
31+
flags: unittests
32+
name: openboot-web-coverage
33+
fail_ci_if_error: false
34+
35+
- name: Build
36+
run: npm run build

.github/workflows/deploy.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: Deploy Website
1+
name: Deploy to Production
22

33
on:
44
push:
5-
branches: [main]
5+
tags:
6+
- 'v*'
67
workflow_dispatch:
78

89
jobs:

AGENTS.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,29 @@ npx wrangler dev # Dev with D1 binding
181181

182182
## CI/CD
183183

184-
Push-to-main auto-deploy via `.github/workflows/deploy.yml`:
184+
**Tag-based releases** — production deploys only when version tags are pushed.
185185

186-
1. `npm install``npm run build`
186+
### CI Workflow (`.github/workflows/ci.yml`)
187+
Triggers on: push to `main`, pull requests
188+
189+
1. `npm install``npm test:coverage``npm run build`
190+
2. Upload coverage to Codecov
191+
3. **No deployment**
192+
193+
### Deploy Workflow (`.github/workflows/deploy.yml`)
194+
Triggers on: push tags matching `v*` (e.g., `v1.0.0`)
195+
196+
1. `npm install``npm test:coverage``npm run build`
187197
2. `wrangler d1 migrations apply openboot --remote` (runs pending migrations)
188198
3. `wrangler deploy` (via cloudflare/wrangler-action)
189199

190-
Migrations run **before** deploy — safe for schema changes that new code depends on.
200+
**Release process:**
201+
```bash
202+
git tag v1.0.0
203+
git push origin v1.0.0
204+
```
205+
206+
See `RELEASE.md` for full release workflow. Migrations run **before** deploy — safe for schema changes that new code depends on.
191207

192208
## NOTES
193209

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,21 @@ GOOGLE_CLIENT_SECRET=...
4141

4242
## Deployment
4343

44-
Push to `main` and GitHub Actions deploys to Cloudflare. Runs migrations before deploying code.
44+
**Tag-based releases** — production deploys only happen when you create a version tag:
45+
46+
```bash
47+
git tag v1.0.0
48+
git push origin v1.0.0
49+
```
50+
51+
This triggers:
52+
1. Tests + build
53+
2. Database migrations
54+
3. Deployment to openboot.dev
55+
56+
Push to `main` only runs CI (tests + build), no deployment.
57+
58+
See [RELEASE.md](./RELEASE.md) for full release process.
4559

4660
Secrets needed: `CLOUDFLARE_API_TOKEN`, `CLOUDFLARE_ACCOUNT_ID`
4761

RELEASE.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# Release Process
2+
3+
This project uses **tag-based releases**. Production deployments only happen when you create a Git tag.
4+
5+
## Quick Release
6+
7+
```bash
8+
# 1. Ensure main branch is ready
9+
git checkout main
10+
git pull
11+
12+
# 2. Create and push a version tag
13+
git tag v1.0.0
14+
git push origin v1.0.0
15+
```
16+
17+
This triggers the production deployment workflow automatically.
18+
19+
## Release Workflow
20+
21+
### 1. Development & Testing
22+
23+
- Push commits to `main` branch
24+
- CI runs automatically (tests + build)
25+
- **No deployment happens**
26+
27+
### 2. Ready to Release
28+
29+
When you're ready to deploy to production:
30+
31+
```bash
32+
# Create a tag following semantic versioning
33+
git tag v1.2.3
34+
35+
# Push the tag to GitHub
36+
git push origin v1.2.3
37+
```
38+
39+
### 3. Automated Deployment
40+
41+
The tag push triggers `.github/workflows/deploy.yml`:
42+
43+
1. ✅ Run tests
44+
2. ✅ Build application
45+
3. ✅ Run database migrations
46+
4. ✅ Deploy to Cloudflare Workers (openboot.dev)
47+
48+
### 4. Verify Deployment
49+
50+
Check GitHub Actions: https://github.com/openbootdotdev/openboot.dev/actions
51+
52+
## Version Numbering
53+
54+
Follow [Semantic Versioning](https://semver.org/):
55+
56+
- **v1.0.0** → Major release (breaking changes)
57+
- **v1.1.0** → Minor release (new features, backward compatible)
58+
- **v1.1.1** → Patch release (bug fixes)
59+
60+
### Examples
61+
62+
```bash
63+
# Bug fix
64+
git tag v1.0.1
65+
git push origin v1.0.1
66+
67+
# New feature
68+
git tag v1.1.0
69+
git push origin v1.1.0
70+
71+
# Breaking change
72+
git tag v2.0.0
73+
git push origin v2.0.0
74+
```
75+
76+
## Rollback
77+
78+
If a deployment has issues:
79+
80+
```bash
81+
# Option 1: Deploy previous version
82+
git push origin v1.0.0 --force-with-lease
83+
84+
# Option 2: Create hotfix tag
85+
git tag v1.0.2
86+
git push origin v1.0.2
87+
```
88+
89+
## Manual Deployment
90+
91+
You can also trigger deployment manually from GitHub:
92+
93+
1. Go to Actions → Deploy to Production
94+
2. Click "Run workflow"
95+
3. Select `main` branch
96+
4. Click "Run workflow"
97+
98+
## Release Checklist
99+
100+
Before tagging a release:
101+
102+
- [ ] All tests passing on `main`
103+
- [ ] Migrations tested locally
104+
- [ ] Breaking changes documented
105+
- [ ] Version number follows semver
106+
- [ ] Previous version tagged (for rollback reference)
107+
108+
## Migration Strategy
109+
110+
Database migrations run automatically before deployment. Ensure:
111+
112+
1. Migration is backward compatible (if possible)
113+
2. Migration tested with `wrangler d1 migrations apply openboot --local`
114+
3. Large migrations coordinated with zero-downtime deployment
115+
116+
## FAQ
117+
118+
**Q: Can I delete a tag?**
119+
```bash
120+
# Delete local tag
121+
git tag -d v1.0.0
122+
123+
# Delete remote tag
124+
git push origin :refs/tags/v1.0.0
125+
```
126+
127+
**Q: What happens if deployment fails?**
128+
- GitHub Actions will show the error
129+
- Previous version remains deployed
130+
- Fix the issue and create a new tag
131+
132+
**Q: How do I see what's deployed?**
133+
- Check latest tag: `git describe --tags --abbrev=0`
134+
- View deployment history in GitHub Actions

0 commit comments

Comments
 (0)