Update lab certification thumbnail #20
This file contains 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 Production | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
deploy-production: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/branch-names@v7 | |
- name: Install the Neon CLI | |
run: npm install -g neonctl | |
- name: get Neon branch ID | |
id: get-neon-branch-id | |
run: | | |
echo ${{ steps.branch-name.outputs.head_ref_branch }} >> $GITHUB_OUTPUT | |
echo branch_id=$(neonctl branches get ${{ steps.branch-name.outputs.head_ref_branch }} --project-id ${{ secrets.NEON_PROJECT_ID }} --api-key ${{ secrets.NEON_API_KEY }} --output json | jq -r '.id') >> $GITHUB_OUTPUT | |
- name: Run Prisma Migrate | |
run: | | |
touch .env | |
echo DATABASE_URL=$(neonctl cs ${{ secrets.NEON_MAIN_BRANCH_NAME }} --project-id ${{ secrets.NEON_PROJECT_ID }} --role-name ${{ secrets.PG_USERNAME }} --database-name ${{ secrets.PG_DATABASE }} --api-key ${{ secrets.NEON_API_KEY }}) >> .env | |
echo DIRECT_DATABASE_URL=$(neonctl cs ${{ secrets.NEON_MAIN_BRANCH_NAME }} --project-id ${{ secrets.NEON_PROJECT_ID }} --role-name ${{ secrets.PG_USERNAME }} --database-name ${{ secrets.PG_DATABASE }} --api-key ${{ secrets.NEON_API_KEY }}) >> .env | |
npx prisma generate | |
npx prisma migrate deploy | |
- name: Install Vercel CLI | |
run: npm install --global vercel@latest | |
- name: Pull Vercel Environment Information | |
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Build Project Artifacts | |
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Deploy Project Artifacts to Vercel | |
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Delete Neon Branch | |
uses: neondatabase/delete-branch-action@v2 | |
with: | |
project_id: ${{ secrets.NEON_PROJECT_ID }} | |
branch_id: ${{ steps.get-neon-branch-id.outputs.branch_id }} | |
api_key: ${{ secrets.NEON_API_KEY }} |