deploy_dashboard.yml 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. steps:
  22. - name: Checkout repository
  23. uses: actions/checkout@v4
  24. - name: Install Node.js
  25. uses: actions/setup-node@v4
  26. with:
  27. node-version: 22
  28. cache: 'npm'
  29. - name: Install dependencies
  30. run: npm install
  31. - name: Install Vercel CLI
  32. run: npm i -g vercel@latest
  33. - name: Build common and core packages
  34. run: npm run build:core-common
  35. - name: Link folder to project
  36. run: vercel link --yes --scope ${{ env.VERCEL_SCOPE }} --project=${{ env.VERCEL_PROJECT }} --token=${{ secrets.VERCEL_TOKEN }}
  37. - name: Pull Vercel Project Information
  38. run: vercel pull --environment=${{ env.VERCEL_ENV }} --yes --scope ${{ env.VERCEL_SCOPE }} --token=${{ secrets.VERCEL_TOKEN }}
  39. - name: Pull Vercel Environment Variables
  40. run: vercel env pull --cwd ./packages/dashboard --environment=${{ env.VERCEL_ENV }} --yes --scope ${{ env.VERCEL_SCOPE }} --token=${{ secrets.VERCEL_TOKEN }}
  41. - name: Build Project Artifacts
  42. run: vercel build --scope ${{ env.VERCEL_SCOPE }} --token=${{ secrets.VERCEL_TOKEN }} ${{ env.VERCEL_ENV == 'production' && '--prod' || '' }}
  43. - name: Deploy Project Artifacts to Vercel
  44. id: deploy_vercel
  45. 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
  46. - name: Print Vercel URL
  47. shell: bash
  48. run: |
  49. echo "Vercel URL: ${{ steps.deploy_vercel.outputs.URL }}"
  50. echo "Vercel Environment: ${{ env.VERCEL_ENV }}"