Fix a few schema errors; improve migration script #23
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 to EC2 | |
| on: | |
| push: | |
| branches: [testing] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10.12.4 # or your version | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build standalone | |
| run: | | |
| pnpm run prisma-generate | |
| pnpm build | |
| - name: Archive standalone output | |
| run: | | |
| mkdir output | |
| cp -r .next/standalone output/standalone | |
| cp -r .next/static output/static | |
| cp -r public output/public | |
| tar -czf output.tar.gz -C output . | |
| - name: Copy build to EC2 | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.AWS_EC2_SSH_HOST }} | |
| username: ${{ secrets.AWS_EC2_SSH_USERNAME }} | |
| key: ${{ secrets.AWS_EC2_SSH_PRIVATE_KEY }} | |
| source: "output.tar.gz" | |
| target: "~/app" | |
| - name: Deploy on EC2 | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.AWS_EC2_SSH_HOST }} | |
| username: ${{ secrets.AWS_EC2_SSH_USERNAME }} | |
| key: ${{ secrets.AWS_EC2_SSH_PRIVATE_KEY }} | |
| script: | | |
| set -e | |
| cd ~/app | |
| rm -rf server | |
| mkdir -p server | |
| tar -xzf output.tar.gz -C server | |
| pm2 delete website || true | |
| pm2 start ecosystem.config.js |