deploy_dashboard.yml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. steps:
  31. - name: Checkout repository
  32. uses: actions/checkout@v4
  33. - name: Install Node.js
  34. uses: actions/setup-node@v4
  35. with:
  36. node-version: 22
  37. cache: 'npm'
  38. - name: Install dependencies
  39. run: npm install
  40. - name: Install Vercel CLI
  41. run: npm i -g vercel@latest
  42. - name: Build common and core packages
  43. run: npm run build:core-common
  44. - name: Create Vercel rewrites in root
  45. run: |
  46. echo '{"rewrites": [{"source": "/(.*)","destination": "/index.html"}]}' > ./vercel.json
  47. - name: Link folder to project
  48. run: vercel link --yes --scope ${{ env.VERCEL_SCOPE }} --project=${{ env.VERCEL_PROJECT }} --token=${{ secrets.VERCEL_TOKEN }}
  49. - name: Pull Vercel Project Information
  50. run: vercel pull --environment=${{ env.VERCEL_ENV }} --yes --scope ${{ env.VERCEL_SCOPE }} --token=${{ secrets.VERCEL_TOKEN }}
  51. - name: Pull Vercel Environment Variables
  52. run: |
  53. vercel env pull --environment=${{ env.VERCEL_ENV }} --yes --scope ${{ env.VERCEL_SCOPE }} --token=${{ secrets.VERCEL_TOKEN }}
  54. cp .env.local packages/dashboard/.env.local
  55. - name: Build Project Artifacts
  56. run: vercel build --scope ${{ env.VERCEL_SCOPE }} --token=${{ secrets.VERCEL_TOKEN }} ${{ env.VERCEL_ENV == 'production' && '--prod' || '' }}
  57. - name: Deploy Project Artifacts to Vercel
  58. id: deploy_vercel
  59. 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
  60. - name: Print Vercel URL
  61. shell: bash
  62. run: |
  63. echo "Vercel URL: ${{ steps.deploy_vercel.outputs.URL }}"
  64. echo "Vercel Environment: ${{ env.VERCEL_ENV }}"