Pass SSH_KEY as parameter

This commit is contained in:
Leonardo Murça 2022-11-01 11:41:53 -03:00
parent 07756f8994
commit 1285693ac8
3 changed files with 4 additions and 4 deletions

View file

@ -21,4 +21,4 @@ jobs:
cache: 'npm' cache: 'npm'
- run: npm install - run: npm install
- run: npm run build:dev - run: npm run build:dev
- run: sh ${GITHUB_WORKSPACE}/scripts/deploy.sh dev - run: sh ${GITHUB_WORKSPACE}/scripts/deploy.sh $SSH_KEY dev

View file

@ -21,4 +21,4 @@ jobs:
cache: 'npm' cache: 'npm'
- run: npm install - run: npm install
- run: npm run build:prod - run: npm run build:prod
- run: sh ${GITHUB_WORKSPACE}/scripts/deploy.sh prod - run: sh ${GITHUB_WORKSPACE}/scripts/deploy.sh $SSH_KEY prod

View file

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
mkdir ~/.ssh && mkdir ~/.ssh &&
echo "$SSH_KEY" >> ~/.ssh/id_rsa_ifsalas && echo "$1" >> ~/.ssh/id_rsa_ifsalas &&
chmod 400 ~/.ssh/id_rsa_ifsalas && chmod 400 ~/.ssh/id_rsa_ifsalas &&
echo -e "Host ifsalas\n\tUser ifsalas\n\tHostname 45.76.5.44\n\tIdentityFile ~/.ssh/id_rsa_ifsalas\n\tStrictHostKeyChecking No" >> ~/.ssh/config && echo -e "Host ifsalas\n\tUser ifsalas\n\tHostname 45.76.5.44\n\tIdentityFile ~/.ssh/id_rsa_ifsalas\n\tStrictHostKeyChecking No" >> ~/.ssh/config &&
rsync -avz --progress build/ ifsalas:/home/ifsalas/web/$1 --delete rsync -avz --progress build/ ifsalas:/home/ifsalas/web/$2 --delete