Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 0 additions & 99 deletions .github/workflows/pr-preview.yml

This file was deleted.

44 changes: 1 addition & 43 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ concurrency:

permissions:
contents: write
deployments: write

jobs:
test:
Expand Down Expand Up @@ -88,46 +87,9 @@ jobs:
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
echo "tag=$TAG" >> "$GITHUB_OUTPUT"

deploy:
name: Deploy to Cloudflare
needs: version
runs-on: ubuntu-latest
environment:
name: production
url: https://universal-net-calc.reconnct.workers.dev
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ needs.version.outputs.tag }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: make install

- name: Deploy to production
run: make deploy-prod
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

- name: Deployment summary
run: |
echo "## 🚀 Cloudflare Deployment" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** ${{ needs.version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
echo "**Tag:** ${{ needs.version.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
echo "**URL:** https://universal-net-calc.reconnct.workers.dev" >> $GITHUB_STEP_SUMMARY
echo "**Status:** ✅ Deployed Successfully" >> $GITHUB_STEP_SUMMARY

github-release:
name: Create GitHub Release
needs: [version, deploy]
needs: version
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -139,18 +101,14 @@ jobs:
- name: Generate release notes
id: release-notes
run: |
# Get the previous tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 "${{ needs.version.outputs.tag }}^" 2>/dev/null || echo "")

if [ -z "$PREVIOUS_TAG" ]; then
# First release
CHANGELOG=$(git log --oneline --pretty=format:"- %s" | head -20)
else
# Generate changelog between tags
CHANGELOG=$(git log "$PREVIOUS_TAG..${{ needs.version.outputs.tag }}" --oneline --pretty=format:"- %s")
fi

# Format for GitHub release
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
Expand Down
44 changes: 18 additions & 26 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ make release # Interactive process:
# → GitHub Actions automatically deploys to production
```

To create a PR preview deployment:
```
# Comment `/release-preview` on any pull request to deploy a preview version to:
# https://universal-net-calc-pr-{PR_NUMBER}.reconnct.workers.dev
```
PR preview deployments happen automatically when a pull request is opened or updated.
The preview URL is posted as a comment on the PR.

**Note:** The developer often runs the server on port 3000 already. When 3000 is occupied assume the server is already running and use the existing service instead of trying to spin up your own

Expand Down Expand Up @@ -298,39 +295,34 @@ If you need a calculation primitive not covered by existing node types:

## CI/CD System

This project uses GitHub Actions for tag-based releases and PR previews:
Deployments are handled by **Cloudflare Workers Builds** (native CI). GitHub Actions handles testing and versioning only.

### Deployment Workflow

**PR Preview (Comment-Triggered):**
- Comment `/release-preview` on any pull request
- Deploys to: `https://universal-net-calc-pr-{PR_NUMBER}.reconnct.workers.dev`
- Only users with write access can trigger previews
- Available for testing until PR is closed

**Production Release (Tag-Based):**
- Create a release locally with `make release`
- Automatically:
- Validates tests pass
- Builds for Cloudflare
- Deploys to production
- Creates GitHub release with changelog
- Available at: `https://universal-net-calc.reconnct.workers.dev`

**PR Validation (Automatic):**
**PR Preview (Cloudflare native):**
- Cloudflare automatically runs `wrangler versions upload` on every PR branch push
- Preview URL is posted in the Cloudflare dashboard and follows the pattern:
`https://<hash>-universal-net-calc.reconnct.workers.dev`

**Production (Cloudflare native):**
- Cloudflare automatically runs `wrangler deploy` on every push to `main`
- Available at: `https://universal-net-calc.reconnct.workers.dev`

**PR Validation (GitHub Actions):**
- Runs on all pull requests
- Code quality checks (ESLint + TypeScript)
- Unit tests (Vitest) + config tests
- Build validation

**Release tagging (GitHub Actions):**
- On push to `main`: bumps patch version, creates git tag, creates GitHub release

### Documentation

- **Complete guide:** `docs/ci-cd.md` - Workflows, setup, troubleshooting
- **Workflow files:** `.github/workflows/`
- `pr.yml` - PR validation
- `pr-preview.yml` - PR preview deployment (comment-triggered)
- `release.yml` - Production release (tag-triggered)
- `deploy.yml` - Reusable deployment workflow
- `pr.yml` - PR validation (lint, tests, build)
- `release.yml` - Version bump and GitHub release (tag-triggered)

### Release Management

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "npm run build:configs && npm run generate:manifest && npm run cf-typegen && next build",
"build:cloudflare": "npm run build:configs && npm run generate:manifest && npm run cf-typegen && npx @opennextjs/cloudflare build",
"build:configs": "node scripts/bundle-configs.mjs",
"generate:manifest": "node generate-manifest.mjs",
"start": "next start",
Expand Down
Loading
Loading