From f1940ef7b69e65850019cb0922b2c48c4785737a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Mur=C3=A7a?= Date: Thu, 22 Sep 2022 14:06:53 -0300 Subject: [PATCH] Add github action to develop deployment --- .github/workflows/deploy-dev.yml | 28 ++++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy-dev.yml diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml new file mode 100644 index 0000000..740cf4a --- /dev/null +++ b/.github/workflows/deploy-dev.yml @@ -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 diff --git a/package.json b/package.json index ef39df4..63e1209 100644 --- a/package.json +++ b/package.json @@ -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": [