deploy-h5.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. name: Deploy unibest site to Pages
  2. on:
  3. # Runs on pushes targeting the default branch
  4. push:
  5. branches: ['main']
  6. # Allows you to run this workflow manually from the Actions tab
  7. workflow_dispatch:
  8. # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
  9. permissions:
  10. contents: read
  11. pages: write
  12. id-token: write
  13. jobs:
  14. # Build job
  15. build:
  16. runs-on: ubuntu-latest
  17. steps:
  18. - uses: actions/checkout@v4
  19. - uses: pnpm/action-setup@v2
  20. with:
  21. version: 8
  22. - uses: actions/setup-node@v4
  23. with:
  24. node-version: '18'
  25. cache: 'pnpm'
  26. - name: Setup Pages
  27. uses: actions/configure-pages@v4
  28. with:
  29. # Automatically inject basePath in your Next.js configuration file and disable
  30. # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
  31. #
  32. # You may remove this line if you want to manage the configuration yourself.
  33. static_site_generator: dist/build/h5
  34. - name: Restore cache
  35. uses: actions/cache@v3
  36. with:
  37. path: |
  38. dist/build/h5
  39. # Generate a new cache whenever packages or source files change.
  40. key: ${{ runner.os }}-unibest-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
  41. # If source files changed but packages didn't, rebuild from a prior cache.
  42. restore-keys: |
  43. ${{ runner.os }}-unibest-${{ hashFiles('**/package-lock.json') }}-
  44. - name: Install dependencies
  45. run: pnpm i
  46. - name: Build
  47. run: pnpm build:h5
  48. - name: Upload artifact
  49. uses: actions/upload-pages-artifact@v3
  50. with:
  51. path: ./dist/build/h5
  52. # Deployment job
  53. deploy:
  54. environment:
  55. name: github-pages
  56. url: ${{ steps.deployment.outputs.page_url }}
  57. runs-on: ubuntu-latest
  58. needs: build
  59. steps:
  60. - name: Deploy to GitHub Pages
  61. id: deployment
  62. uses: actions/deploy-pages@v4