Split ALTER and INSERT migrations (V11, V12) (#64) #30
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy COMS Website | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to COMS server | |
| env: | |
| DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} | |
| DEPLOY_USER: ${{ secrets.DEPLOY_USER }} | |
| DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }} | |
| DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }} | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "$DEPLOY_SSH_KEY" > ~/.ssh/deploy_key | |
| chmod 600 ~/.ssh/deploy_key | |
| ssh-keyscan -p "$DEPLOY_PORT" "$DEPLOY_HOST" >> ~/.ssh/known_hosts | |
| ssh -i ~/.ssh/deploy_key -p "$DEPLOY_PORT" "$DEPLOY_USER@$DEPLOY_HOST" << 'REMOTE' | |
| set -e | |
| cd ~/apps/coms-website | |
| git fetch origin main | |
| git reset --hard origin/main | |
| docker compose -f docker-compose.yml up -d --build --remove-orphans | |
| docker image prune -f | |
| for attempt in 1 2 3 4 5 6 7 8 9 10; do | |
| if curl -fsS http://127.0.0.1:8080/actuator/health; then | |
| break | |
| fi | |
| if [ "$attempt" -eq 10 ]; then | |
| docker compose -f docker-compose.yml ps | |
| docker logs --tail=200 coms-backend | |
| exit 1 | |
| fi | |
| sleep 3 | |
| done | |
| for attempt in 1 2 3 4 5 6 7 8 9 10; do | |
| if curl -fI https://coms.kw.ac.kr/ && curl -f https://coms.kw.ac.kr/api/server/time; then | |
| break | |
| fi | |
| if [ "$attempt" -eq 10 ]; then | |
| docker compose -f docker-compose.yml ps | |
| docker logs --tail=200 coms-backend | |
| docker logs --tail=100 coms-frontend | |
| exit 1 | |
| fi | |
| sleep 3 | |
| done | |
| REMOTE |