deploy_dashboard.yml 2.6 KB

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