forked from Savitura/crowdpay
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.75 KB
/
Copy pathdeploy.yml
File metadata and controls
63 lines (53 loc) · 1.75 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
57
58
59
60
61
62
63
name: Deploy
on:
workflow_run:
workflows: ["CI"]
branches: [main]
types:
- completed
jobs:
deploy:
name: Deploy to Production
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push backend image
uses: docker/build-push-action@v5
with:
context: ./backend
push: true
tags: ghcr.io/${{ github.repository }}/backend:latest
- name: Deploy backend
run: echo "Deploying backend to hosting provider..."
# Replace with actual deploy command, e.g., Fly.io:
# flyctl deploy --image ghcr.io/${{ github.repository }}/backend:latest
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
- name: Setup Node.js for migrations
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run DB migrations
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
run: node migrate.js
- name: Deploy frontend
run: echo "Deploying frontend to static hosting..."
# Replace with actual deploy action, e.g., Vercel:
# npx vercel --prod --token ${{ secrets.VERCEL_TOKEN }}
- name: Post deploy status to Slack
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
text: Deployment to production completed.
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()