Skip to content

fixed yaml/git issue with prisma #23

fixed yaml/git issue with prisma

fixed yaml/git issue with prisma #23

Workflow file for this run

name: Deploy to Production Server
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
environment: 'ISV2 deployment'
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up SSH connection
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.TEMP_SERVER_SSH_PRIVATE_KEY }}
- name: Connect and deploy
run: |
ssh -o StrictHostKeyChecking=no ${{ vars.TEMP_SERVER_USER }}@${{ vars.TEMP_SERVER_ADDRESS }} << 'EOF'
cd internsystem-v2
cat <<'EOT' > .env.production
DATABASE_URL = 'mysql://${{ secrets.DATABASE_USER }}:${{ secrets.DATABASE_PASSWORD }}@localhost:3306/${{ secrets.DATABASE_NAME }}'
NEXTAUTH_URL = '${{ vars.NEXTAUTH_URL }}'
NEXTAUTH_CALLBACK = '${{ secrets.NEXTAUTH_URL }}/pages/main/home'
NEXTAUTH_SECRET = '${{ secrets.NEXTAUTH_SECRET }}'
NEXTAUTH_GITHUB_CLIENT_ID = '${{ vars.NEXTAUTH_GITHUB_CLIENT_ID }}'
NEXTAUTH_GITHUB_CLIENT_SECRET = '${{ secrets.NEXTAUTH_GITHUB_CLIENT_SECRET }}'
NODEMAILER_NOREPLY_USER = '${{ secrets.NODEMAILER_NOREPLY_USER }}'
NODEMAILER_NOREPLY_PASSWORD = '${{ secrets.NODEMAILER_NOREPLY_PASSWORD }}'
NEXT_PUBLIC_SANITY_API_VERSION = '${{ vars.NEXT_PUBLIC_SANITY_API_VERSION }}'
NEXT_PUBLIC_SANITY_DATASET = '${{ vars.NEXT_PUBLIC_SANITY_DATASET }}'
NEXT_PUBLIC_SANITY_PROJECT_ID = '${{ vars.NEXT_PUBLIC_SANITY_PROJECT_ID }}'
EOT
rm prisma/schema.prisma
git pull origin main
npm install
npx dotenv -e .env.production npx prisma db pull
npx prisma generate
npm run build
npx pm2 restart ISV2_start_script
EOF