Add github action to develop deployment

This commit is contained in:
Leonardo Murça 2022-09-22 14:06:53 -03:00
parent 992b04f85b
commit f1940ef7b6
2 changed files with 30 additions and 1 deletions

28
.github/workflows/deploy-dev.yml vendored Normal file
View file

@ -0,0 +1,28 @@
name: Deploy to Development
on:
push:
branches: [ "development" ]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
SSH_KEY: ${{secrets.SSH_KEY}}
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'npm'
- run: mkdir ~/.ssh
- run: 'echo "$SSH_KEY" >> ~/.ssh/id_rsa_ifsalas'
- run: chmod 400 ~/.ssh/id_rsa_ifsalas
- run: echo -e "Host ifsalas\n\tUser ifsalas\n\tHostname 45.76.5.44\n\tIdentityFile ~/.ssh/id_rsa_ifsalas\n\tStrictHostKeyChecking No" >> ~/.ssh/config
- run: npm install
- run: npm run build
- run: npm run deploy:dev

View file

@ -26,7 +26,8 @@
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"deploy:prod": "rsync -avz --progress build/ ifsalas:/home/ifsalas/web/prod --delete"
"deploy:prod": "rsync -avz --progress build/ ifsalas:/home/ifsalas/web/prod --delete",
"deploy:dev": "rsync -avz --progress build/ ifsalas:/home/ifsalas/web/dev --delete"
},
"eslintConfig": {
"extends": [