Files
syncfilm/.github/workflows/deploy.yml
T

43 lines
975 B
YAML

name: Deploy to VM Prod
on:
push:
branches:
- main
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Deploy to production
run: |
REPO_NAME=${{ github.event.repository.name }}
if [ -z "${{ secrets.ENV_FILE }}" ]; then
ENV_CONTENT=""
else
ENV_CONTENT="${{ secrets.ENV_FILE }}"
fi
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "
mkdir -p /srv/$REPO_NAME
cd /srv/$REPO_NAME
if [ ! -d .git ]; then
rm -rf ./*
git clone https://github.com/arthur-pbty-labs/$REPO_NAME .
else
git reset --hard
git pull origin main
fi
if [ -n \"$ENV_CONTENT\" ]; then
echo \"$ENV_CONTENT\" > .env
fi
docker compose up -d --build
"