Skip to content

CI Deploy Prod

CI Deploy Prod #388

Workflow file for this run

# This is a deploy workflow to production server
name: CI Deploy Prod
on:
workflow_dispatch:
jobs:
call-workflow-build:
uses: townteki/townsquare-client/.github/workflows/build.yml@master
deploy-prod:
runs-on: ubuntu-latest
needs: call-workflow-build
steps:
- uses: actions/checkout@v2
- name: Git update
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_PROD_HOST }}
username: ${{ secrets.REMOTE_PROD_USER }}
key: ${{ secrets.PROD_SERVER_SSH_KEY }}
script: |
cd ${{ secrets.REMOTE_PROD_TARGET }}
git fetch
git reset --hard origin/master
git clean -fd
git submodule update --remote
- name: Cleanup and update from PT
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_PROD_HOST }}
username: ${{ secrets.REMOTE_PROD_USER }}
key: ${{ secrets.PROD_SERVER_SSH_KEY }}
script: |
rm -f ${{ secrets.REMOTE_PROD_TARGET }}/public/* || true
rm -f ${{ secrets.REMOTE_PROD_TARGET }}/public/img/* || true
rm -r ${{ secrets.REMOTE_PROD_TARGET }}/public/fonts || true
rm -r ${{ secrets.REMOTE_PROD_TARGET }}/public/sound || true
- name: Get built dist
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Deploy dist
uses: easingthemes/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.PROD_SERVER_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: "dist/"
REMOTE_HOST: ${{ secrets.REMOTE_PROD_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_PROD_USER }}
TARGET: ${{ secrets.REMOTE_PROD_TARGET }}/public
EXCLUDE: "/images/cards/, /node_modules/"
- name: Deploy assets
uses: easingthemes/[email protected]
env:
SSH_PRIVATE_KEY: ${{ secrets.PROD_SERVER_SSH_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: "assets/"
REMOTE_HOST: ${{ secrets.REMOTE_PROD_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_PROD_USER }}
TARGET: ${{ secrets.REMOTE_PROD_TARGET }}/public
call-server-restart:
uses: townteki/townsquare-client/.github/workflows/prod-restart.yml@master
secrets: inherit
needs: deploy-prod