deploy-github-pages.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. runs-on: ubuntu-latest
  38. needs: build
  39. permissions:
  40. pages: write
  41. id-token: write
  42. steps:
  43. - name: Deploy to GitHub Pages
  44. id: deployment
  45. uses: actions/deploy-pages@v4
  46. notify:
  47. name: Send Discord workflow notification
  48. runs-on: ubuntu-latest
  49. needs: deploy
  50. steps:
  51. - name: Send notification
  52. uses: annybs/action-notify-discord@v1
  53. if: ${{ always() }}
  54. with:
  55. repository: ${{ github.repository }}
  56. result: ${{ needs.deploy.result }}
  57. run-id: ${{ github.run_id }}
  58. run-number: ${{ github.run_number }}
  59. webhook-url: ${{ secrets.DISCORD_WEBHOOK }}
  60. workflow: ${{ github.workflow }}