Skip to content

Commit 2c8f8aa

Browse files
ci: deploy from main branch instead of production
GitHub Pages default environment protection only allows main branch. New workflow: - main: tests + deploy (production) - PRs to main: tests only - production branch: deprecated (can be deleted)
1 parent 550c57c commit 2c8f8aa

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
name: CI/CD Pipeline
22

3+
# Workflow Strategy:
4+
# - main branch: Run tests + deploy to GitHub Pages (production)
5+
# - Pull requests to main: Run tests only (no deploy)
6+
# - Feature branches: Use PRs to main for code review
7+
38
on:
49
push:
5-
branches: [production]
10+
branches: [main]
611
pull_request:
7-
branches: [production]
12+
branches: [main]
813

914
jobs:
1015
test:
@@ -51,7 +56,8 @@ jobs:
5156
name: Deploy to GitHub Pages
5257
runs-on: ubuntu-latest
5358
needs: test
54-
if: github.event_name == 'push'
59+
# Only deploy on push to main (not on PRs)
60+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
5561

5662
permissions:
5763
contents: read

0 commit comments

Comments
 (0)