-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (30 loc) · 1.18 KB
/
web-deploy.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
name: Deploy Web Project
on:
repository_dispatch:
types: [trigger-deploy]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v2
with:
repository: ${{ github.event.client_payload.repo_name }}
ref: ${{ github.event.client_payload.branch }}
- name: Install Dependencies
run: npm install
- name: Decode Config Secret
id: decode-config
run: |
echo "${{ github.event.client_payload.config_secret }}" | base64 --decode > ./src/lib/axios/config.json
- name: Build Project
run: npm run build
- name: Create Destination Directory If Not Exists
run: |
ssh -i ${{ secrets.SERVER_SSH_KEY }} ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} \
"mkdir -p ${{ github.event.client_payload.destination_directory }}"
- name: Deploy Files to Server
run: |
rsync -avz -e "ssh -i ${{ secrets.SERVER_SSH_KEY }}" \
./${{ github.event.client_payload.source_directory }}/ \
${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:${{ github.event.client_payload.destination_directory }}