Created
February 2, 2023 14:28
-
-
Save Valexr/54f6205c5070ec4b91489fa5f80b83b6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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