Skip to content

Merge pull request #2761 from daostack/staging #456

Merge pull request #2761 from daostack/staging

Merge pull request #2761 from daostack/staging #456

Workflow file for this run

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 [email protected]: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 [email protected]: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