deploy-github-pages.yml 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. name: "Deploy to GitHub Pages"
  2. on:
  3. workflow_dispatch:
  4. push:
  5. branches:
  6. - develop
  7. jobs:
  8. build:
  9. name: Build
  10. runs-on: ubuntu-latest
  11. steps:
  12. - name: Set up Node.js
  13. uses: actions/setup-node@v4
  14. env:
  15. NODE_AUTH_TOKEN: ${{ github.token }}
  16. with:
  17. node-version: 20.x
  18. - name: Checkout repository
  19. uses: actions/checkout@v4
  20. - name: Set auth token
  21. run: echo '//npm.pkg.github.com/:_authToken=${{ secrets.GH_PAT }}' >> .npmrc
  22. - name: Install dependencies
  23. run: npm ci
  24. - name: Build statics
  25. run: npm run build
  26. env:
  27. VITE_ANALYTICS_WEBSITE_ID: ${{ vars.ANALYTICS_WEBSITE_ID }}
  28. - name: Upload artifact
  29. uses: actions/upload-pages-artifact@v3
  30. with:
  31. name: github-pages
  32. path: dist/
  33. retention-days: 3
  34. # https://github.com/actions/deploy-pages?tab=readme-ov-file#usage
  35. deploy:
  36. name: Deploy
  37. needs: build
  38. permissions:
  39. pages: write
  40. id-token: write
  41. runs-on: ubuntu-latest
  42. steps:
  43. - name: Deploy to GitHub Pages
  44. id: deployment
  45. uses: actions/deploy-pages@v4
  46. # # https://github.com/annybs/notify-discord
  47. # notify:
  48. # name: Notify Discord
  49. # uses: annybs/notify-discord@develop
  50. # needs: deploy
  51. # if: ${{ always() }}
  52. # with:
  53. # discord-webhook: ${{ secrets.DISCORD_WEBHOOK }}
  54. # repository: ${{ github.repository }}
  55. # result: ${{ needs.deploy.result }}
  56. # run_id: ${{ github.run_id }}
  57. # run_number: ${{ github.run_number }}
  58. # workflow: ${{ github.workflow }}