Skip to content

refactor deploy preview action #3

refactor deploy preview action

refactor deploy preview action #3

name: Deploy Preview
on:
push:
branches:
- 'main'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy to Preview Server
uses: appleboy/[email protected]
env:
MICONFIG: ${{ secrets.MICONFIG_PREVIEW }}
PK: ${{ secrets.BENTO_PK_PREVIEW }}
with:
host: ${{ secrets.PREVIEW_SERVER_IP }}
username: ${{ secrets.PREVIEW_USER }}
key: ${{ secrets.PREVIEW_SERVER_SSH_KEY }}
envs: MICONFIG,PK
script: |
echo "Cloning repository"
cd ~
rm -rf repo
git clone [email protected]:${{ github.repository }}.git repo
cd repo
echo "Copy deploy preview script"
cp .github/scripts/deploy-preview.sh .
echo "Running deploy-preview.sh"
chmod +x deploy-preview.sh
./deploy-preview.sh
echo "Performing cleanup..."
cd ~
echo "Remove repository"
rm -rf repo
echo "Docker cleanup"
docker system prune -f
echo "Done: Cleanup"