-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploye_angular_build_ec2.yml
More file actions
69 lines (54 loc) · 1.61 KB
/
deploye_angular_build_ec2.yml
File metadata and controls
69 lines (54 loc) · 1.61 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
name: Angular Build and Deploy
on:
push:
branches:
- development
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm install --force
- name: Build Angular app
run: npm run build -- --configuration=production
- name: Archive build artifacts
uses: actions/upload-artifact@v2
with:
name: angular-build
path: dist/
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: angular-build
path: dist/
- name: Compress artifacts
run: tar czf deploy.tar.gz dist/
- name: Copy artifacts to EC2
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
source: "deploy.tar.gz"
target: "/var/www/html/test/"
- name: SSH into EC2 and extract artifacts
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /var/www/html/test/
tar xzf deploy.tar.gz