-
Notifications
You must be signed in to change notification settings - Fork 6
76 lines (59 loc) ยท 1.67 KB
/
fe-merge-prod.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
name: Frontend production CD
on:
workflow_dispatch:
pull_request:
branches: [ develop ]
types: [closed]
paths: frontend/**
permissions:
contents: read
jobs:
build-and-upload:
if: github.event.pull_request.merged
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
cache-dependency-path: "frontend"
- name: Install npm
run: npm install
working-directory: frontend
- name: grant execute access
run: chmod +x npm
working-directory: frontend
- name: Build project
run: npm run build
working-directory: frontend
- name: upload to artifact
uses: actions/upload-artifact@v3
with:
name: FrontendApplication
path: frontend/dist
deploy:
runs-on: [ self-hosted, prod]
needs: build-and-upload
if: github.event.pull_request.merged
steps:
- name: delete old js file
run: rm -rf /home/ubuntu/frontend/dist
- name: download js file from artifact
uses: actions/download-artifact@v3
with:
name: FrontendApplication
path: /home/ubuntu/frontend/
- name: deploy
run: /home/ubuntu/frontend/deploy.sh
- name: send slack message
uses: 8398a7/action-slack@v3
with:
mention: 'here'
if_mention: always
status: ${{ job.status }}
fields: workflow,job,commit,message,ref,author,took
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()