-
Notifications
You must be signed in to change notification settings - Fork 8
66 lines (63 loc) · 2.27 KB
/
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
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
# This is a deploy workflow to production server
name: CI Deploy Prod
on:
workflow_dispatch:
jobs:
call-workflow-build:
uses: townteki/townsquare-client/.github/workflows/build.yml@master
deploy-prod:
runs-on: ubuntu-latest
needs: call-workflow-build
steps:
- uses: actions/checkout@v2
- name: Git update
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_PROD_HOST }}
username: ${{ secrets.REMOTE_PROD_USER }}
key: ${{ secrets.PROD_SERVER_SSH_KEY }}
script: |
cd ${{ secrets.REMOTE_PROD_TARGET }}
git fetch
git reset --hard origin/master
git clean -fd
git submodule update --remote
- name: Cleanup and update from PT
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_PROD_HOST }}
username: ${{ secrets.REMOTE_PROD_USER }}
key: ${{ secrets.PROD_SERVER_SSH_KEY }}
script: |
rm -f ${{ secrets.REMOTE_PROD_TARGET }}/public/* || true
rm -f ${{ secrets.REMOTE_PROD_TARGET }}/public/img/* || true
rm -r ${{ secrets.REMOTE_PROD_TARGET }}/public/fonts || true
rm -r ${{ secrets.REMOTE_PROD_TARGET }}/public/sound || true
- name: Get built dist
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Deploy dist
uses: easingthemes/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.PROD_SERVER_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: "dist/"
REMOTE_HOST: ${{ secrets.REMOTE_PROD_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_PROD_USER }}
TARGET: ${{ secrets.REMOTE_PROD_TARGET }}/public
EXCLUDE: "/images/cards/, /node_modules/"
- name: Deploy assets
uses: easingthemes/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.PROD_SERVER_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: "assets/"
REMOTE_HOST: ${{ secrets.REMOTE_PROD_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_PROD_USER }}
TARGET: ${{ secrets.REMOTE_PROD_TARGET }}/public
call-server-restart:
uses: townteki/townsquare-client/.github/workflows/prod-restart.yml@master
secrets: inherit
needs: deploy-prod