-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (70 loc) · 2.71 KB
/
deploy.yml
File metadata and controls
82 lines (70 loc) · 2.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
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
name: Deploy to Vercel
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build TypeScript
run: npm run build
- name: Run tests
run: npm test || true # Continue even if tests fail (remove '|| true' if you want to enforce passing tests)
- name: Trigger Vercel Deployment
id: deploy
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.vercel.com/v1/integrations/deploy/prj_ksJkCDQcTVzcrpL5UnChSBgxpQ9s/t4bbILlRlx'
method: 'GET'
timeout: 60000 # 60 seconds timeout
preventFailureOnNoResponse: true
- name: Check deployment status
if: steps.deploy.outputs.status != '200'
run: |
echo "Deployment failed with status: ${{ steps.deploy.outputs.status }}"
echo "Response: ${{ steps.deploy.outputs.response }}"
- name: Retry deployment (1st attempt)
if: steps.deploy.outputs.status != '200'
id: retry1
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.vercel.com/v1/integrations/deploy/prj_ksJkCDQcTVzcrpL5UnChSBgxpQ9s/t4bbILlRlx'
method: 'GET'
timeout: 60000
preventFailureOnNoResponse: true
- name: Retry deployment (2nd attempt)
if: steps.retry1.outputs.status != '200'
id: retry2
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.vercel.com/v1/integrations/deploy/prj_ksJkCDQcTVzcrpL5UnChSBgxpQ9s/t4bbILlRlx'
method: 'GET'
timeout: 60000
preventFailureOnNoResponse: true
- name: Retry deployment (final attempt)
if: steps.retry2.outputs.status != '200'
id: retry3
uses: fjogeleit/http-request-action@v1
with:
url: 'https://api.vercel.com/v1/integrations/deploy/prj_ksJkCDQcTVzcrpL5UnChSBgxpQ9s/t4bbILlRlx'
method: 'GET'
timeout: 60000
preventFailureOnNoResponse: true
- name: Deployment status notification
run: |
if [[ "${{ steps.deploy.outputs.status }}" == "200" || "${{ steps.retry1.outputs.status }}" == "200" || "${{ steps.retry2.outputs.status }}" == "200" || "${{ steps.retry3.outputs.status }}" == "200" ]]; then
echo "Deployment to Vercel was successful!"
else
echo "All deployment attempts failed. Please check Vercel configuration and try again."
exit 1
fi