1
0

deploy_dashboard.yml 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. name: '🚀 Deploy Dashboard'
  2. on:
  3. push:
  4. branches:
  5. - minor
  6. - major
  7. - master
  8. paths:
  9. - 'packages/dashboard/**'
  10. - 'package.json'
  11. - 'package-lock.json'
  12. - 'packages/core/**'
  13. - 'packages/common/**'
  14. env:
  15. NEXT_TELEMETRY_DISABLED: 1
  16. NODE_OPTIONS: '--max_old_space_size=4096'
  17. VERCEL_PROJECT: admin-dashboard
  18. VERCEL_SCOPE: vendure
  19. concurrency:
  20. group: ${{ github.workflow }}-${{ github.ref }}
  21. cancel-in-progress: true
  22. jobs:
  23. deploy:
  24. runs-on: ubuntu-latest
  25. permissions:
  26. contents: read
  27. env:
  28. # VERCEL_ENV: ${{ github.ref_name == 'minor' && 'development' || github.ref_name == 'major' && 'major' || 'production' }}
  29. VERCEL_ENV: production
  30. VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
  31. steps:
  32. - name: Checkout repository
  33. uses: actions/checkout@v4
  34. - name: Install Node.js
  35. uses: actions/setup-node@v4
  36. with:
  37. node-version: 22
  38. cache: 'npm'
  39. - name: Install dependencies
  40. run: npm install
  41. - name: Install Vercel CLI
  42. run: npm i -g vercel@latest
  43. - name: Build common and core packages
  44. run: npm run build:core-common
  45. - name: Create Vercel rewrites in root
  46. run: |
  47. echo '{"rewrites": [{"source": "/(.*)","destination": "/index.html"}]}' > ./vercel.json
  48. - name: Link folder to project
  49. run: vercel link --yes --scope ${{ env.VERCEL_SCOPE }} --project=${{ env.VERCEL_PROJECT }} --token=$VERCEL_TOKEN
  50. - name: Pull Vercel Project Information
  51. run: vercel pull --environment=${{ env.VERCEL_ENV }} --yes --scope ${{ env.VERCEL_SCOPE }} --token=$VERCEL_TOKEN
  52. - name: Pull Vercel Environment Variables
  53. run: |
  54. vercel env pull --environment=${{ env.VERCEL_ENV }} --yes --scope ${{ env.VERCEL_SCOPE }} --token=$VERCEL_TOKEN
  55. cp .env.local packages/dashboard/.env.local
  56. - name: Build Project Artifacts
  57. run: vercel build --scope ${{ env.VERCEL_SCOPE }} --token=$VERCEL_TOKEN ${{ env.VERCEL_ENV == 'production' && '--prod' || '' }}
  58. - name: Deploy Project Artifacts to Vercel
  59. id: deploy_vercel
  60. run: vercel deploy --archive=tgz --prebuilt --scope ${{ env.VERCEL_SCOPE }} ${{ env.VERCEL_ENV == 'production' && '--prod' || '' }} --token=$VERCEL_TOKEN | awk 'END{print}' | awk '{print "URL="$1}' >> $GITHUB_OUTPUT
  61. - name: Print Vercel URL
  62. shell: bash
  63. run: |
  64. echo "Vercel URL: ${{ steps.deploy_vercel.outputs.URL }}"
  65. echo "Vercel Environment: ${{ env.VERCEL_ENV }}"