-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (37 loc) · 1.22 KB
/
server-refresh.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
name: Refresh server
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- dev
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
server-refresh:
name: Refresh server
runs-on: ubuntu-latest
steps:
- name: Copy Repo Files
uses: actions/checkout@v2
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: 'a'
- name: construct script
env:
NODE_ENV: development
run: |
printf "#!/bin/bash\n" > ./server_exec.sh
printf "SERVER_PATH=${{secrets.SERVER_PATH}}\n" >> ./server_exec.sh
cat ./scripts/server-refresh.sh >> ./server_exec.sh
chmod +x ./server_exec.sh
- name: Exec Script
env:
SSH_USERNAME: ${{ secrets.SSH_USERNAME }}
SSH_HOST: ${{ secrets.SSH_HOST }}
PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
cat ./server_exec.sh
ssh ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} < ./server_exec.sh