Improve pipeline by removing steps from packagejson

This commit is contained in:
Leonardo Murça 2022-11-01 11:25:15 -03:00
parent 15a625d785
commit 78e7800601
4 changed files with 17 additions and 13 deletions

View file

@ -19,10 +19,7 @@ jobs:
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:dev
- run: npm run deploy:dev
- name: Copying build files to server
- run: sh ${GITHUB_WORKSPACE}/scripts/deploy.sh dev

View file

@ -19,10 +19,7 @@ jobs:
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:prod
- run: npm run deploy:prod
- name: Copying build files to server
- run: sh ${GITHUB_WORKSPACE}/scripts/deploy.sh prod

View file

@ -30,9 +30,7 @@
"start:dev": "env-cmd -f .env.dev npm run start",
"start:prod": "env-cmd -f .env.prod npm run start ",
"build:dev": "env-cmd -f .env.dev npm run build",
"build:prod": "env-cmd -f .env.prod npm run build",
"deploy:prod": "rsync -avz --progress build/ ifsalas:/home/ifsalas/web/prod --delete",
"deploy:dev": "rsync -avz --progress build/ ifsalas:/home/ifsalas/web/dev --delete"
"build:prod": "env-cmd -f .env.prod npm run build"
},
"eslintConfig": {
"extends": [

12
scripts/deploy.sh Normal file
View file

@ -0,0 +1,12 @@
#!/bin/sh
mkdir ~/.ssh &&
echo "$SSH_KEY" >> ~/.ssh/id_rsa_ifsalas &&
chmod 400 ~/.ssh/id_rsa_ifsalas &&
echo -e "
Host ifsalas\n\t \
User ifsalas\n\t \
Hostname 45.76.5.44\n\t \
IdentityFile ~/.ssh/id_rsa_ifsalas\n\t \
StrictHostKeyChecking No" >> ~/.ssh/config &&
rsync -avz --progress build/ ifsalas:/home/ifsalas/web/$1 --delete