Skip to content

Instantly share code, notes, and snippets.

@Valexr
Created February 2, 2023 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Valexr/54f6205c5070ec4b91489fa5f80b83b6 to your computer and use it in GitHub Desktop.
Save Valexr/54f6205c5070ec4b91489fa5f80b83b6 to your computer and use it in GitHub Desktop.
name: "Deploy to Server"
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: "Build deployment code for standalone"
env:
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_port: ${{ secrets.DEPLOY_PORT }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}
dev_env_file: ${{ secrets.DEV_ENV_FILE }}
local_dir: "build/"
remote_dir: "/var/html"
run: |
npm install
CI=false npm run build
mkdir ~/.ssh
echo "$remote_key" > ~/.ssh/id_github
chmod 600 ~/.ssh/id_github
echo "$dev_env_file" > .env
chmod 600 .env
rsync -avzr --delete -e "ssh -p ${remote_port} -i ~/.ssh/id_github -o StrictHostKeyChecking=no" ${local_dir} ${remote_user}@${remote_host}:${remote_dir}
rm ~/.ssh/id_github
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment