Skip to content

Merge pull request #38 from KonferCA/pipe/30/test-db #10

Merge pull request #38 from KonferCA/pipe/30/test-db

Merge pull request #38 from KonferCA/pipe/30/test-db #10

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: |
clean_up() {
echo "Performing cleanup..."
cd ~
echo "Remove repository"
rm -rf repo
echo "Docker cleanup"
docker system prune -f
echo "Done: Cleanup"
}
handle_error() {
clean_up
echo "Failed to deploy preview"
exit 1
}
trap 'handler_error' ERR
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