forked from KCEE0901/trustchain-escrow
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (75 loc) · 2.7 KB
/
Copy pathdeploy.yml
File metadata and controls
83 lines (75 loc) · 2.7 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Deploy
on:
push:
branches: [main]
workflow_dispatch:
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
jobs:
deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
environment: staging
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
# Block the deploy if any required secret is missing, weak, or a placeholder.
- name: Validate environment secrets
working-directory: backend
env:
JWT_SECRET: ${{ secrets.JWT_SECRET }}
JWT_ACCESS_SECRET: ${{ secrets.JWT_ACCESS_SECRET }}
JWT_REFRESH_SECRET: ${{ secrets.JWT_REFRESH_SECRET }}
MFA_JWT_SECRET: ${{ secrets.MFA_JWT_SECRET }}
ADMIN_JWT_SECRET: ${{ secrets.ADMIN_JWT_SECRET }}
ADMIN_API_KEY: ${{ secrets.ADMIN_API_KEY }}
run: node scripts/check-env.js
- name: Deploying to Staging
run: |
echo "Deploying to Staging environment..."
# Insert actual deployment commands here (e.g., SSH, Cloud provider CLI)
echo "Successfully deployed to Staging"
- name: Slack Notification Success
if: ${{ success() && env.SLACK_WEBHOOK != '' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: good
SLACK_MESSAGE: 'Staging Deployment: success'
- name: Slack Notification Failure
if: ${{ failure() && env.SLACK_WEBHOOK != '' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: danger
SLACK_MESSAGE: 'Staging Deployment: failure'
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
needs: deploy-staging
environment:
name: production
url: https://stellar-trust-escrow.com
steps:
- uses: actions/checkout@v4
- name: Deploying to Production
run: |
echo "Deploying to Production environment..."
# Insert actual deployment commands here
echo "Successfully deployed to Production"
- name: Slack Notification Success
if: ${{ success() && env.SLACK_WEBHOOK != '' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: good
SLACK_MESSAGE: 'Production Deployment: success'
- name: Slack Notification Failure
if: ${{ failure() && env.SLACK_WEBHOOK != '' }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: danger
SLACK_MESSAGE: 'Production Deployment: failure'