Skip to content

added next-intl dashboard #29

added next-intl dashboard

added next-intl dashboard #29

name: Vercel Preview Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
push:
branches-ignore:
- migration-to-rest
pull_request:
branches:
- migration-to-rest
paths:
- "../../apps/api/**"
jobs:
Deploy-Preview:
name: Deploy to Vercel Preview Hosting
runs-on: ubuntu-latest
outputs:
preview_url: ${{ steps.preview-deployment.outputs.preview_url }}
steps:
- name: Initial Checkout
uses: actions/checkout@v4.1.7
- name: Install Typescript Compile Tools
run: npm install --global tsc typescript turbo
- name: Compile Typescript
run: npm run build
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel for Preview
id: preview-deployment
run: |
preview_url=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})
echo "preview_url=$preview_url" >> "$GITHUB_OUTPUT"
Github-Deployment:
name: Create Github Deployment for Preview Environment
runs-on: ubuntu-latest
needs: Deploy-Preview
permissions:
deployments: write
steps:
- name: Add Failed Preview Deployment
id: preview-deployment-failure
if: ${{ needs.Deploy-Preview.result == 'failure' }}
uses: chrnorm/deployment-action@v2.0.7
with:
token: "${{ secrets.GITHUB_TOKEN }}"
initial-status: "failure"
environment-url: ${{ needs.Deploy-Preview.outputs.preview_url }}
environment: preview
- name: Add Successful Preview Deployment
id: preview-deployment-success
if: ${{ needs.Deploy-Preview.result == 'success' }}
uses: chrnorm/deployment-action@v2.0.7
with:
token: "${{ secrets.GITHUB_TOKEN }}"
initial-status: "success"
environment-url: ${{ needs.Deploy-Preview.outputs.preview_url }}
environment: preview
PR-Comment:
name: Comment on Pull Requests Based on Vercel Deployment Success
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
needs: Deploy-Preview
steps:
- name: Finding Pull Request ID
id: pr_id_finder
uses: jwalton/gh-find-current-pr@v1.3.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Add PR Comment for Vercel Deployment Failure
if: ${{ steps.pr_id_finder.outputs.pr && needs.Deploy-Preview.result == 'failure' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_ID: ${{ steps.pr_id_finder.outputs.pr }}
run: |
gh pr comment $PR_ID --body "Deployment Failure"
- name: Add PR Comment for Vercel Deployment Success
if: ${{ steps.pr_id_finder.outputs.pr && needs.Deploy-Preview.result == 'success' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_ID: ${{ steps.pr_id_finder.outputs.pr }}
run: |
gh pr comment $PR_ID --body "Deployment Success; Changes available at ${{ needs.Deploy-Preview.outputs.preview_url }}"