-
Notifications
You must be signed in to change notification settings - Fork 168
42 lines (40 loc) · 1.47 KB
/
main.yml
File metadata and controls
42 lines (40 loc) · 1.47 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
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v2
with:
node-version: '10'
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Create temp Directory
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
script: mkdir -p ~/frontends/codingblocks.com/temp
- name: Upload Build
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
source: "dist"
target: "frontends/codingblocks.com"
- name: Replace New Build
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.PRIVATE_KEY }}
script: ln -sfn ~/frontends/codingblocks.com/dist ~/frontends/codingblocks.com/current && rm -rf ~/frontends/codingblocks.com/live/* && cp -rf ~/frontends/codingblocks.com/dist/* ~/frontends/codingblocks.com/live/ && ln -sfn ~/frontends/codingblocks.com/live ~/frontends/codingblocks.com/current && rm -rf ~/frontends/codingblocks.com/dist