-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (69 loc) · 2.74 KB
/
node.js.yml
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
name: Rollup
on:
push:
branches: ['prod']
jobs:
build_and_deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run build --if-present
- name: copy file via ssh password
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
source: './dist/'
target: '/home/aukus/deploy/frontend/prod/deploy_build'
- name: swap build and restart nginx
uses: appleboy/[email protected]
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
command_timeout: 1m
script: cd "/home/aukus/deploy/frontend/prod" && rm -rf build && mkdir build && mv deploy_build/dist/* ./build/ && rm -r deploy_build/dist
- name: Aukus prod frontend build and upload success!
uses: rjstone/discord-webhook-notify@v1
if: success()
with:
severity: info
details: Aukus prod frontend build and upload success!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
- name: Checkout repository
uses: actions/checkout@v2
- name: Success to telegram
if: success()
run: |
COMMIT_AUTHOR=$(git log -1 --pretty=%an)
COMMIT_TEXT=$(git log --oneline -n 1)
msg_text="✅Aukus prod frontend build and upload success!%0AAuthor: $COMMIT_AUTHOR %0ACommit: $COMMIT_TEXT"
curl -s -X POST 'https://api.telegram.org/bot${{ secrets.TG_TOKEN }}/sendMessage' \
-d "message_thread_id=20&chat_id=-1002471795184_20&text=${msg_text}&"
- name: Aukus prod frontend build and upload failure!
uses: rjstone/discord-webhook-notify@v1
if: failure()
with:
severity: error
details: Aukus prod frontend build and upload failure!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
- name: Failure to telegram
if: failure()
run: |
COMMIT_AUTHOR=$(git log -1 --pretty=%an)
COMMIT_TEXT=$(git log --oneline -n 1)
msg_text="⚠️Aukus prod frontend build and failure!%0AAuthor: $COMMIT_AUTHOR %0ACommit: $COMMIT_TEXT"
curl -s -X POST 'https://api.telegram.org/bot${{ secrets.TG_TOKEN }}/sendMessage' \
-d "message_thread_id=20&chat_id=-1002471795184_20&text=${msg_text}&"