-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (56 loc) · 2.19 KB
/
qa.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
name: Deploy Angular to QA
on:
push:
branches:
- qa
jobs:
deploy-artifact:
name: "Deploy artifact"
runs-on: ubuntu-latest
steps:
- name: Get last repository version
uses: actions/checkout@v2
- name: Configure Node 18
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Build app
run: |
npm install
npm install -g @angular/cli > /dev/null
ng build --configuration=qa --base-href /
- name: Create artifact
env:
GITHUB_SHA: ${{ github.sha }}
run: tar -czf "${GITHUB_SHA}".tar.gz dist
- name: Upload to server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: ${{ secrets.SERVER_PORT }}
source: ${{ github.sha }}.tar.gz
target: /tmp/artifacts
- name: Extract files and create directories
uses: appleboy/ssh-action@master
env:
GITHUB_SHA: ${{ github.sha }}
SERVER_PASSWORD: ${{ secrets.SERVER_PASSWORD }}
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
port: ${{ secrets.SERVER_PORT }}
envs: GITHUB_SHA,SERVER_PASSWORD
script: |
# Create application folder
echo ${SERVER_PASSWORD} | sudo -S mkdir -p "${{ secrets.DEPLOY_PATH }}/qa/frontend"
# Extract the tar file into our release directory
echo ${SERVER_PASSWORD} | sudo -S tar xzf /tmp/artifacts/${GITHUB_SHA}.tar.gz -C "${{ secrets.DEPLOY_PATH }}/qa/frontend"
# Move dist folder
echo ${SERVER_PASSWORD} | sudo -S cp -a "${{ secrets.DEPLOY_PATH }}/qa/frontend/dist/${{ secrets.ANGULAR_APP_NAME }}/." ${{ secrets.DEPLOY_PATH }}/qa/frontend
# Delete dist folder
echo ${SERVER_PASSWORD} | sudo -S rm -rf "${{ secrets.DEPLOY_PATH }}/qa/frontend/dist"
# Remove tmp directory
rm -rf /tmp/artifacts