Skip to content

[add] server refresh #3

[add] server refresh

[add] server refresh #3

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