55 branches : [dev, main]
66 pull_request :
77 branches : [dev, main]
8+ workflow_dispatch :
9+ inputs :
10+ environment :
11+ description : ' Environment to deploy to'
12+ required : true
13+ default : ' development'
14+ type : choice
15+ options :
16+ - development
17+ - production
818
919# Prevent multiple concurrent deployments
1020concurrency :
@@ -16,49 +26,15 @@ jobs:
1626 name : Deploy to Development
1727 runs-on : ubuntu-latest
1828 environment : Development
19- # ONLY run for dev branch pushes or PRs targeting dev
20- if : github.ref == 'refs/heads/dev' || (github.event_name == 'pull_request' && github.base_ref == 'dev')
29+ # Run for: dev branch pushes, PRs targeting dev, or manual dispatch to development
30+ if : |
31+ github.ref == 'refs/heads/dev' ||
32+ (github.event_name == 'pull_request' && github.base_ref == 'dev') ||
33+ (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'development')
2134 permissions :
2235 deployments : write
2336 pull-requests : write
2437 steps :
25- - name : Debug Secrets and Environment
26- run : |
27- echo "=== DEBUGGING DEVELOPMENT DEPLOYMENT ==="
28- echo "GitHub Ref: ${{ github.ref }}"
29- echo "GitHub Event: ${{ github.event_name }}"
30- echo "GitHub Base Ref: ${{ github.base_ref }}"
31- echo "Environment: Development"
32- echo ""
33- echo "=== CHECKING SECRETS ==="
34- echo "RENDER_SERVICE_ID exists: ${{ secrets.RENDER_SERVICE_ID != '' }}"
35- echo "RENDER_SERVICE_ID length: ${#RENDER_SERVICE_ID}"
36- echo "RENDER_SERVICE_ID value: ${{ secrets.RENDER_SERVICE_ID }}"
37- echo "RENDER_SERVICE_ID (first 10 chars): ${RENDER_SERVICE_ID:0:10}..."
38- echo ""
39- echo "RENDER_API_KEY exists: ${{ secrets.RENDER_API_KEY != '' }}"
40- echo "RENDER_API_KEY length: ${#RENDER_API_KEY}"
41- echo "RENDER_API_KEY value: ${{ secrets.RENDER_API_KEY }}"
42- echo "RENDER_API_KEY (first 10 chars): ${RENDER_API_KEY:0:10}..."
43- echo ""
44- echo "SITE_URL exists: ${{ secrets.SITE_URL != '' }}"
45- echo "SITE_URL value: ${{ secrets.SITE_URL }}"
46- echo ""
47- echo "=== ENVIRONMENT VARIABLES ==="
48- env | grep -E "(RENDER|GITHUB)" || true
49- echo ""
50- echo "=== TESTING RENDER API ==="
51- echo "Testing API connection with service ID: ${{ secrets.RENDER_SERVICE_ID }}"
52- curl -v -H "Authorization: Bearer ${{ secrets.RENDER_API_KEY }}" \
53- "https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID }}" || true
54- echo ""
55- echo "=== LISTING ALL SERVICES (for debugging) ==="
56- curl -v -H "Authorization: Bearer ${{ secrets.RENDER_API_KEY }}" \
57- "https://api.render.com/v1/services?limit=100" || true
58- env :
59- RENDER_SERVICE_ID : ${{ secrets.RENDER_SERVICE_ID }}
60- RENDER_API_KEY : ${{ secrets.RENDER_API_KEY }}
61-
6238 - name : Trigger Render Deploy
6339 id : deploy
6440 uses :
JorgeLNJunior/[email protected] @@ -127,49 +103,15 @@ jobs:
127103 name : Deploy to Production
128104 runs-on : ubuntu-latest
129105 environment : Production
130- # ONLY run for main branch pushes or PRs targeting main
131- if : github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && github.base_ref == 'main')
106+ # Run for: main branch pushes, PRs targeting main, or manual dispatch to production
107+ if : |
108+ github.ref == 'refs/heads/main' ||
109+ (github.event_name == 'pull_request' && github.base_ref == 'main') ||
110+ (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production')
132111 permissions :
133112 deployments : write
134113 pull-requests : write
135114 steps :
136- - name : Debug Secrets and Environment
137- run : |
138- echo "=== DEBUGGING PRODUCTION DEPLOYMENT ==="
139- echo "GitHub Ref: ${{ github.ref }}"
140- echo "GitHub Event: ${{ github.event_name }}"
141- echo "GitHub Base Ref: ${{ github.base_ref }}"
142- echo "Environment: Production"
143- echo ""
144- echo "=== CHECKING SECRETS ==="
145- echo "RENDER_SERVICE_ID exists: ${{ secrets.RENDER_SERVICE_ID != '' }}"
146- echo "RENDER_SERVICE_ID length: ${#RENDER_SERVICE_ID}"
147- echo "RENDER_SERVICE_ID value: ${{ secrets.RENDER_SERVICE_ID }}"
148- echo "RENDER_SERVICE_ID (first 10 chars): ${RENDER_SERVICE_ID:0:10}..."
149- echo ""
150- echo "RENDER_API_KEY exists: ${{ secrets.RENDER_API_KEY != '' }}"
151- echo "RENDER_API_KEY length: ${#RENDER_API_KEY}"
152- echo "RENDER_API_KEY value: ${{ secrets.RENDER_API_KEY }}"
153- echo "RENDER_API_KEY (first 10 chars): ${RENDER_API_KEY:0:10}..."
154- echo ""
155- echo "SITE_URL exists: ${{ secrets.SITE_URL != '' }}"
156- echo "SITE_URL value: ${{ secrets.SITE_URL }}"
157- echo ""
158- echo "=== ENVIRONMENT VARIABLES ==="
159- env | grep -E "(RENDER|GITHUB)" || true
160- echo ""
161- echo "=== TESTING RENDER API ==="
162- echo "Testing API connection with service ID: ${{ secrets.RENDER_SERVICE_ID }}"
163- curl -v -H "Authorization: Bearer ${{ secrets.RENDER_API_KEY }}" \
164- "https://api.render.com/v1/services/${{ secrets.RENDER_SERVICE_ID }}" || true
165- echo ""
166- echo "=== LISTING ALL SERVICES (for debugging) ==="
167- curl -v -H "Authorization: Bearer ${{ secrets.RENDER_API_KEY }}" \
168- "https://api.render.com/v1/services?limit=100" || true
169- env :
170- RENDER_SERVICE_ID : ${{ secrets.RENDER_SERVICE_ID }}
171- RENDER_API_KEY : ${{ secrets.RENDER_API_KEY }}
172-
173115 - name : Trigger Render Deploy
174116 id : deploy
175117 uses :
JorgeLNJunior/[email protected]
0 commit comments