Staging Deployment #45
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: Staging Deployment | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| workflow_dispatch: | |
| jobs: | |
| deploy_staging: | |
| name: Deploy Staging | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: staging | |
| url: ${{ vars.ENV_URL }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '21.1.0' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Generate Prisma Client | |
| run: npx prisma generate | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| - name: Run database migrations | |
| run: npm run db:migrate | |
| env: | |
| DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
| - name: Lint and build code, then publish to Vercel | |
| run: > | |
| npx vercel | |
| --token ${{ secrets.VERCEL_TOKEN }} | |
| -n ${{ vars.VERCEL_PROJECT }} | |
| --yes | |
| --prod | |
| --env NEXT_PUBLIC_GRAPHQL_ENDPOINT=${{ vars.GRAPHQL_ENDPOINT }} | |
| --env DATABASE_URL=${{ secrets.DATABASE_URL }} | |
| --env AUTH_SECRET=${{ secrets.AUTH_SECRET }} | |
| --env API_KEY=${{ secrets.API_KEY }} | |
| --build-env NEXT_PUBLIC_GRAPHQL_ENDPOINT=${{ vars.GRAPHQL_ENDPOINT }} | |
| --build-env DATABASE_URL=${{ secrets.DATABASE_URL }} | |
| --build-env AUTH_SECRET=${{ secrets.AUTH_SECRET }} | |
| --build-env API_KEY=${{ secrets.API_KEY }} | |
| - name: Success | |
| run: echo "🛠️ Deploy successful 🛠️" |