Skip to content

Instantly share code, notes, and snippets.

@bibhuticoder
Created August 2, 2021 08:25
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 bibhuticoder/631491f6e084b5594a95d07ec646c307 to your computer and use it in GitHub Desktop.
Save bibhuticoder/631491f6e084b5594a95d07ec646c307 to your computer and use it in GitHub Desktop.
# name of github action workflow
name: deploy-to-dev-droplet
on:
push:
branches:
- dev # this script will run when pushed to "dev" branch
jobs:
deploy-frontend:
runs-on: ubuntu-latest #using latest ubuntu to build application
steps:
- name: Deploy frontend
uses: appleboy/ssh-action@master
with:
key: ${{ secrets.SSH_PRIVATE_KEY_DEV }}
host: ${{ secrets.HOST_DEV }}
username: ${{ secrets.USERNAME }}
script: |
cd /frontend-project-folder
git stash
GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa_frontend' git pull origin dev
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
npm install
npm run build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment