Skip to content

Deploy to prod server #2

Deploy to prod server

Deploy to prod server #2

Workflow file for this run

name: Deploy to prod server
# when prod image build action is completed, run this action
on:
workflow_run:
workflows: ["Build docker image on release tag created"]
types:
- completed
jobs:
if_workflow_success:
name: Deploy to prod server
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: pull the image and restart the container
uses: appleboy/ssh-action@v1.0.0
with:
host: ${{ secrets.PROD_HOST }}
port: ${{ secrets.PROD_PORT }}
username: ${{ secrets.PROD_USERNAME }}
password: ${{ secrets.PROD_PASSWORD }}
proxy_host: ${{ secrets.PROD_PROXY_HOST }}
proxy_port: ${{ secrets.PROD_PROXY_PORT }}
proxy_username: ${{ secrets.PROD_PROXY_USERNAME }}
proxy_password: ${{ secrets.PROD_PROXY_PASSWORD }}
script_stop: true # stop script if any command has failed
script: |
docker pull ghcr.io/sparcs-kaist/zabo-front:latest
docker rm -f zabo-front
docker run --restart always -d -p ${{ secrets.PROD_CONTAINER_PORT }}:80 --name zabo-front ghcr.io/sparcs-kaist/zabo-front:latest