deploy_dashboard.yml 2.8 KB

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