build.yml 919 B

12345678910111213141516171819202122232425262728293031323334353637
  1. name: Build and Deploy
  2. on: [ push, pull_request ]
  3. jobs:
  4. build-and-deploy:
  5. runs-on: ubuntu-latest
  6. environment:
  7. name: github-pages
  8. steps:
  9. - name: Checkout
  10. uses: actions/checkout@v3
  11. - name: Setup Node.js environment
  12. uses: actions/[email protected]
  13. with:
  14. node-version: "12.x"
  15. - name: Install dependencies
  16. run: npm install
  17. - name: Build
  18. run: npm run docs:build
  19. - name: Deploy
  20. run: |
  21. pwd
  22. cd docs/.vuepress/dist/
  23. pwd
  24. git init
  25. git config --global user.name "github-actions[bot]"
  26. git config --global user.email "${{ secrets.DRAGONOS_EMAIL }}"
  27. git branch
  28. git branch -m gh-pages && git checkout gh-pages
  29. git add .
  30. git commit -m "deploy"
  31. git push -f [email protected]:DragonOS-Community/OS_lab_tutorial.git gh-pages
  32. cd -