Skip to content

Commit d7ebd2c

Browse files
committed
ci
1 parent a8e8f40 commit d7ebd2c

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/production-cy.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@master
13+
- name: Get yarn cache directory path
14+
id: yarn-cache-dir-path
15+
run: echo "::set-output name=dir::$(yarn cache dir)"
16+
17+
- uses: actions/cache@v1
18+
id: yarn-cache
19+
with:
20+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
21+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
22+
restore-keys: |
23+
${{ runner.os }}-yarn-
24+
25+
- name: Read .nvmrc
26+
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
27+
id: nvm
28+
- name: Use Node.js (.nvmrc)
29+
uses: actions/setup-node@v1
30+
with:
31+
node-version: "${{ steps.nvm.outputs.NVMRC }}"
32+
- name: Installing Dependencies
33+
run: yarn install
34+
- name: Build
35+
run: yarn build --env production
36+
- name: Create temp Directory
37+
uses: appleboy/ssh-action@master
38+
with:
39+
host: ${{ secrets.HOST_PRODUCTION }}
40+
username: ${{ secrets.USERNAME }}
41+
key: ${{ secrets.PRIVATE_KEY }}
42+
script: mkdir -p ~/temp && rm -rf ~/temp/*
43+
- name: Upload Build
44+
uses: appleboy/scp-action@master
45+
with:
46+
host: ${{ secrets.HOST_PRODUCTION }}
47+
username: ${{ secrets.USERNAME }}
48+
key: ${{ secrets.PRIVATE_KEY }}
49+
source: "dist"
50+
target: "temp"
51+
- name: Replace New Build
52+
uses: appleboy/ssh-action@master
53+
with:
54+
host: ${{ secrets.HOST_PRODUCTION }}
55+
username: ${{ secrets.USERNAME }}
56+
key: ${{ secrets.PRIVATE_KEY }}
57+
script: rm -rf ~/frontends/troublemaker.codingblocks.com/* && cp -rf ~/temp/dist/* ~/frontends/troublemaker.codingblocks.com && rm -rf ~/temp

0 commit comments

Comments
 (0)