Merge pull request #2735 from daostack/dev #444
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Web Deployment CD | |
on: | |
push: | |
branches: [ staging, master ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: 'Push staging to server' | |
if: ${{ github.ref == 'refs/heads/staging' }} | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.INSTANCE_IP_STAGING }} | |
username: ${{ secrets.INSTANCE_USERNAME }} | |
key: ${{ secrets.INSTANCE_KEY_STAGING }} | |
command_timeout: 200m | |
script: echo "${{ secrets.GIT_REPO_KEY }}" > /home/common/.ssh/id_rsa && chmod 600 /home/common/.ssh/id_rsa && cd ~ && sudo rm -rf common-web && GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@github.com:daostack/common-web.git && cd common-web && git checkout staging && docker system prune -af && docker build --build-arg REACT_APP_ENV=stage -t common-ui:latest . && docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) && docker run -d -p 80:80 --name common-ui common-ui:latest | |
- name: 'Push master to server' | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.INSTANCE_IP_PRODUCTION }} | |
username: ${{ secrets.INSTANCE_USERNAME }} | |
key: ${{ secrets.INSTANCE_KEY_PRODUCTION }} | |
command_timeout: 200m | |
script: echo "${{ secrets.GIT_REPO_KEY }}" > /home/common/.ssh/id_rsa && chmod 600 /home/common/.ssh/id_rsa && cd ~ && sudo rm -rf common-web && GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" git clone git@github.com:daostack/common-web.git && cd common-web && git checkout master && docker system prune -af && docker build --build-arg REACT_APP_ENV=production -t common-ui:latest . && docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) && docker run -d -p 80:80 --name common-ui common-ui:latest |