deploy-github-pages.yml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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