Skip to content

Commit b17c1a4

Browse files
authored
chore: Remove deployment functionality from CICD
1 parent d3bed68 commit b17c1a4

1 file changed

Lines changed: 0 additions & 264 deletions

File tree

β€Ž.github/workflows/ci-cd.ymlβ€Ž

Lines changed: 0 additions & 264 deletions
Original file line numberDiff line numberDiff line change
@@ -249,267 +249,3 @@ jobs:
249249
name: frontend-test-results
250250
path: frontend/coverage/
251251
retention-days: 30
252-
253-
# Job 5: Deploy to staging environment
254-
deploy-staging:
255-
name: Deploy to Staging
256-
runs-on: ubuntu-latest
257-
needs: [backend-test, frontend-test]
258-
# Only deploy on push to main/master branch (not on PRs)
259-
if: github.event_name == 'push' && (github.ref == 'refs/heads/main')
260-
261-
environment:
262-
name: staging
263-
url: https://staging.ipa.jannismilz.com
264-
265-
steps:
266-
# Checkout the repository code
267-
- name: Checkout code
268-
uses: actions/checkout@v4
269-
270-
# Trigger Dokploy staging deployment via API
271-
- name: Deploy to Dokploy Staging
272-
id: deploy
273-
env:
274-
DOKPLOY_HOSTNAME: ${{ secrets.DOKPLOY_HOSTNAME }}
275-
DOKPLOY_API_TOKEN: ${{ secrets.DOKPLOY_API_TOKEN }}
276-
DOKPLOY_STAGING_FRONTEND_APPID: ${{ secrets.DOKPLOY_STAGING_FRONTEND_APPID }}
277-
DOKPLOY_STAGING_BACKEND_APPID: ${{ secrets.DOKPLOY_STAGING_BACKEND_APPID }}
278-
run: |
279-
echo "πŸš€ Triggering Dokploy staging deployment..."
280-
281-
# Trigger backend deployment
282-
echo "πŸ“¦ Deploying backend..."
283-
backend_response=$(curl -X POST \
284-
"https://$DOKPLOY_HOSTNAME/api/application.deploy" \
285-
-H 'accept: application/json' \
286-
-H 'Content-Type: application/json' \
287-
-H "x-api-key: $DOKPLOY_API_TOKEN" \
288-
-d "{\"applicationId\": \"$DOKPLOY_STAGING_BACKEND_APPID\"}" \
289-
-w "\n%{http_code}" \
290-
-s)
291-
292-
backend_http_code=$(echo "$backend_response" | tail -n1)
293-
backend_body=$(echo "$backend_response" | head -n-1)
294-
295-
echo "Backend Response: $backend_body"
296-
echo "Backend HTTP Status: $backend_http_code"
297-
298-
if [ "$backend_http_code" -ge 200 ] && [ "$backend_http_code" -lt 300 ]; then
299-
echo "βœ… Backend deployment triggered successfully"
300-
else
301-
echo "❌ Backend deployment failed with status $backend_http_code"
302-
echo "Response: $backend_body"
303-
exit 1
304-
fi
305-
306-
# Trigger frontend deployment
307-
echo "πŸ“¦ Deploying frontend..."
308-
frontend_response=$(curl -X POST \
309-
"https://$DOKPLOY_HOSTNAME/api/application.deploy" \
310-
-H 'accept: application/json' \
311-
-H 'Content-Type: application/json' \
312-
-H "x-api-key: $DOKPLOY_API_TOKEN" \
313-
-d "{\"applicationId\": \"$DOKPLOY_STAGING_FRONTEND_APPID\"}" \
314-
-w "\n%{http_code}" \
315-
-s)
316-
317-
frontend_http_code=$(echo "$frontend_response" | tail -n1)
318-
frontend_body=$(echo "$frontend_response" | head -n-1)
319-
320-
echo "Frontend Response: $frontend_body"
321-
echo "Frontend HTTP Status: $frontend_http_code"
322-
323-
if [ "$frontend_http_code" -ge 200 ] && [ "$frontend_http_code" -lt 300 ]; then
324-
echo "βœ… Frontend deployment triggered successfully"
325-
else
326-
echo "❌ Frontend deployment failed with status $frontend_http_code"
327-
echo "Response: $frontend_body"
328-
exit 1
329-
fi
330-
331-
echo "πŸ“ Environment: https://staging.ipa.jannismilz.com"
332-
333-
# Wait for deployment to be ready (optional)
334-
- name: Verify staging deployment
335-
run: |
336-
echo "⏳ Waiting for staging deployment to be ready..."
337-
sleep 10
338-
339-
# Check if frontend is responding
340-
echo "πŸ” Checking frontend..."
341-
if curl -f -s -o /dev/null https://staging.ipa.jannismilz.com; then
342-
echo "βœ… Frontend is live and responding"
343-
frontend_ok=true
344-
else
345-
echo "❌ Frontend health check failed"
346-
frontend_ok=false
347-
fi
348-
349-
# Check if API is responding
350-
echo "πŸ” Checking API..."
351-
if curl -f -s -o /dev/null https://staging.ipa.jannismilz.com/api/evaluations/criteria; then
352-
echo "βœ… API is live and responding"
353-
api_ok=true
354-
else
355-
echo "❌ API health check failed"
356-
api_ok=false
357-
fi
358-
359-
# Final status
360-
if [ "$frontend_ok" = true ] && [ "$api_ok" = true ]; then
361-
echo "βœ… Staging environment fully operational"
362-
else
363-
echo "⚠️ Staging deployment triggered but health check failed"
364-
echo "Note: Deployment may still be in progress"
365-
fi
366-
367-
# Job 6: Deploy to production environment
368-
deploy-production:
369-
name: Deploy to Production
370-
runs-on: ubuntu-latest
371-
needs: [backend-test, frontend-test]
372-
# Only deploy when a new tag is pushed (e.g., v1.0.0, v2.1.3)
373-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
374-
375-
environment:
376-
name: production
377-
url: https://ipa.jannismilz.com
378-
379-
steps:
380-
# Checkout the repository code
381-
- name: Checkout code
382-
uses: actions/checkout@v4
383-
384-
# Extract tag version for deployment
385-
- name: Extract tag version
386-
id: tag
387-
run: |
388-
TAG=${GITHUB_REF#refs/tags/}
389-
echo "version=$TAG" >> $GITHUB_OUTPUT
390-
echo "πŸ“¦ Deploying version: $TAG"
391-
392-
# Trigger Dokploy production deployment via API
393-
- name: Deploy to Dokploy Production
394-
id: deploy
395-
env:
396-
DOKPLOY_HOSTNAME: ${{ secrets.DOKPLOY_HOSTNAME }}
397-
DOKPLOY_API_TOKEN: ${{ secrets.DOKPLOY_API_TOKEN }}
398-
DOKPLOY_PRODUCTION_FRONTEND_APPID: ${{ secrets.DOKPLOY_PRODUCTION_FRONTEND_APPID }}
399-
DOKPLOY_PRODUCTION_BACKEND_APPID: ${{ secrets.DOKPLOY_PRODUCTION_BACKEND_APPID }}
400-
DOKPLOY_PRODUCTION_FRONTEND_ENV_TEMPLATE: ${{ secrets.DOKPLOY_PRODUCTION_FRONTEND_ENV_TEMPLATE }}
401-
run: |
402-
echo "πŸš€ Triggering Dokploy production deployment..."
403-
echo "Version: ${{ steps.tag.outputs.version }}"
404-
405-
# Trigger backend deployment
406-
echo "πŸ“¦ Deploying backend..."
407-
backend_response=$(curl -X POST \
408-
"https://$DOKPLOY_HOSTNAME/api/application.deploy" \
409-
-H 'accept: application/json' \
410-
-H 'Content-Type: application/json' \
411-
-H "x-api-key: $DOKPLOY_API_TOKEN" \
412-
-d "{\"applicationId\": \"$DOKPLOY_PRODUCTION_BACKEND_APPID\"}" \
413-
-w "\n%{http_code}" \
414-
-s)
415-
416-
backend_http_code=$(echo "$backend_response" | tail -n1)
417-
backend_body=$(echo "$backend_response" | head -n-1)
418-
419-
echo "Backend Response: $backend_body"
420-
echo "Backend HTTP Status: $backend_http_code"
421-
422-
if [ "$backend_http_code" -ge 200 ] && [ "$backend_http_code" -lt 300 ]; then
423-
echo "βœ… Backend deployment triggered successfully"
424-
else
425-
echo "❌ Backend deployment failed with status $backend_http_code"
426-
echo "Response: $backend_body"
427-
exit 1
428-
fi
429-
430-
# Update frontend environment variables with version
431-
echo "πŸ“ Updating frontend environment variables..."
432-
env_response=$(curl -X POST \
433-
"https://$DOKPLOY_HOSTNAME/api/application.saveEnvironment" \
434-
-H 'accept: application/json' \
435-
-H 'Content-Type: application/json' \
436-
-H "x-api-key: $DOKPLOY_API_TOKEN" \
437-
-d "{\"applicationId\": \"$DOKPLOY_PRODUCTION_FRONTEND_APPID\", \"buildArgs\": \"VITE_APP_VERSION=${{ steps.tag.outputs.version }}\", \"createEnvFile\": true}" \
438-
-w "\n%{http_code}" \
439-
-s)
440-
441-
env_http_code=$(echo "$env_response" | tail -n1)
442-
env_body=$(echo "$env_response" | head -n-1)
443-
444-
echo "Environment Update Response: $env_body"
445-
echo "Environment Update HTTP Status: $env_http_code"
446-
447-
if [ "$env_http_code" -ge 200 ] && [ "$env_http_code" -lt 300 ]; then
448-
echo "βœ… Frontend environment variables updated successfully"
449-
else
450-
echo "❌ Frontend environment update failed with status $env_http_code"
451-
echo "Response: $env_body"
452-
exit 1
453-
fi
454-
455-
# Trigger frontend deployment
456-
echo "πŸ“¦ Deploying frontend..."
457-
frontend_response=$(curl -X POST \
458-
"https://$DOKPLOY_HOSTNAME/api/application.deploy" \
459-
-H 'accept: application/json' \
460-
-H 'Content-Type: application/json' \
461-
-H "x-api-key: $DOKPLOY_API_TOKEN" \
462-
-d "{\"applicationId\": \"$DOKPLOY_PRODUCTION_FRONTEND_APPID\"}" \
463-
-w "\n%{http_code}" \
464-
-s)
465-
466-
frontend_http_code=$(echo "$frontend_response" | tail -n1)
467-
frontend_body=$(echo "$frontend_response" | head -n-1)
468-
469-
echo "Frontend Response: $frontend_body"
470-
echo "Frontend HTTP Status: $frontend_http_code"
471-
472-
if [ "$frontend_http_code" -ge 200 ] && [ "$frontend_http_code" -lt 300 ]; then
473-
echo "βœ… Frontend deployment triggered successfully"
474-
else
475-
echo "❌ Frontend deployment failed with status $frontend_http_code"
476-
echo "Response: $frontend_body"
477-
exit 1
478-
fi
479-
480-
echo "πŸ“ Environment: https://ipa.jannismilz.com"
481-
echo "🏷️ Version: ${{ steps.tag.outputs.version }}"
482-
483-
# Wait for deployment to be ready
484-
- name: Verify production deployment
485-
run: |
486-
echo "⏳ Waiting for production deployment to be ready..."
487-
sleep 10
488-
489-
# Check if frontend is responding
490-
echo "πŸ” Checking frontend..."
491-
if curl -f -s -o /dev/null https://ipa.jannismilz.com; then
492-
echo "βœ… Frontend is live and responding"
493-
frontend_ok=true
494-
else
495-
echo "❌ Frontend health check failed"
496-
frontend_ok=false
497-
fi
498-
499-
# Check if API is responding
500-
echo "πŸ” Checking API..."
501-
if curl -f -s -o /dev/null https://ipa.jannismilz.com/api/evaluations/criteria; then
502-
echo "βœ… API is live and responding"
503-
api_ok=true
504-
else
505-
echo "❌ API health check failed"
506-
api_ok=false
507-
fi
508-
509-
# Final status
510-
if [ "$frontend_ok" = true ] && [ "$api_ok" = true ]; then
511-
echo "βœ… Production environment fully operational"
512-
else
513-
echo "⚠️ Production deployment triggered but health check failed"
514-
echo "Note: Deployment may still be in progress"
515-
fi

0 commit comments

Comments
Β (0)