1
0

deploy_dashboard.yml 2.8 KB

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