forked from supabase/realtime
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (48 loc) · 1.71 KB
/
sync-main-to-prod.yml
File metadata and controls
56 lines (48 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Create PR from main to prod
on:
push:
branches:
- main
workflow_dispatch: # Allow manual trigger
jobs:
create-prod-pr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch all branches
run: git fetch origin
- name: Check if prod branch exists and has differences
id: check
run: |
# Check if prod branch exists
if git rev-parse --verify origin/prod >/dev/null 2>&1; then
# Branch exists, check for differences
if git diff --quiet origin/prod origin/main; then
echo "changes=false" >> $GITHUB_OUTPUT
echo "branch_exists=true" >> $GITHUB_OUTPUT
else
echo "changes=true" >> $GITHUB_OUTPUT
echo "branch_exists=true" >> $GITHUB_OUTPUT
fi
else
# Branch doesn't exist, create it
echo "changes=true" >> $GITHUB_OUTPUT
echo "branch_exists=false" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request from main to prod
if: steps.check.outputs.changes == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
--head main \
--base prod \
--title "🚀 Deploy main changes to prod" \
--body "## Deploy to Production
Latest changes from main are ready for production deployment.
**Approve this PR to start the build** - the build will be automatically triggered on the prod branch.
---
*Auto-generated by main-to-prod workflow*"