deploy-h5.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: Deploy Pages
  2. on:
  3. # Runs on pushes targeting the default branch
  4. push:
  5. branches: ['gh-pages']
  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: Restore cache
  27. uses: actions/cache@v3
  28. with:
  29. path: |
  30. dist/build/h5
  31. # Generate a new cache whenever packages or source files change.
  32. key: ${{ runner.os }}-unibest-${{ hashFiles('**/pnpm-lock.yaml') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
  33. # If source files changed but packages didn't, rebuild from a prior cache.
  34. restore-keys: |
  35. ${{ runner.os }}-unibest-${{ hashFiles('**/pnpm-lock.yaml') }}-
  36. - name: Install dependencies
  37. run: pnpm i
  38. - name: Build
  39. run: pnpm build:h5
  40. - name: Upload artifact
  41. uses: actions/upload-pages-artifact@v3
  42. with:
  43. path: ./dist/build/h5
  44. # Deployment job
  45. deploy:
  46. environment:
  47. name: github-pages
  48. url: ${{ steps.deployment.outputs.page_url }}
  49. runs-on: ubuntu-latest
  50. needs: build
  51. steps:
  52. - name: Deploy to GitHub Pages
  53. id: deployment
  54. uses: actions/deploy-pages@v4