deploy-dev-docs.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. name: Deploy developer docs
  2. on:
  3. push:
  4. branches: [ master, docs ]
  5. paths:
  6. - 'src/**'
  7. - 'docs/dev/**'
  8. - '.github/workflows/deploy-dev-docs.yml'
  9. jobs:
  10. build-and-deploy:
  11. runs-on: ubuntu-22.04
  12. steps:
  13. - name: Install dependencies
  14. run: |
  15. sudo apt-get --yes --quiet update
  16. sudo apt-get --yes --no-install-recommends install doxygen
  17. pip install \
  18. mkdocs \
  19. mkdocs-material \
  20. git+https://github.com/veracioux/mkdoxy@v1.0.0
  21. - name: Checkout flameshot source
  22. uses: actions/checkout@v4
  23. with:
  24. path: 'flameshot'
  25. - name: Build docs
  26. working-directory: ${{github.workspace}}/flameshot/docs/dev
  27. run: |
  28. make build
  29. - name: Checkout flameshot website
  30. uses: actions/checkout@v4
  31. with:
  32. repository: 'flameshot-org/flameshot-org.github.io'
  33. ref: 'gh-pages'
  34. path: 'website'
  35. - name: Configure git credentials for website repo
  36. working-directory: ${{github.workspace}}/website
  37. run: |
  38. git config user.name "GitHub Actions"
  39. git config user.email "github-actions-bot@users.noreply.github.com"
  40. git config http.https://github.com/.extraheader 'AUTHORIZATION basic ${{secrets.TOKEN_PUSH_TO_WEBSITE_REPO}}'
  41. git remote add destination "https://x-access-token:${{secrets.TOKEN_PUSH_TO_WEBSITE_REPO}}@github.com/flameshot-org/flameshot-org.github.io"
  42. - name: Add developer docs to website deployment
  43. working-directory: ${{github.workspace}}/website
  44. run: |
  45. # Create empty dev-docs-staging branch
  46. git checkout --orphan dev-docs-staging
  47. git rm -r --cached .
  48. rm -rf docs/dev
  49. # Copy generated docs over
  50. mkdir -p docs
  51. mv "${{github.workspace}}/flameshot/docs/dev/output" \
  52. "./docs/dev"
  53. # Commit docs/dev to the dev-docs-staging branch
  54. git add docs/dev
  55. HASH="$(git --git-dir="${{github.workspace}}/flameshot/.git" rev-parse HEAD)"
  56. git commit --message "Add developer docs from flameshot@$HASH"
  57. # Apply changes to gh-pages
  58. git checkout --force gh-pages
  59. git checkout dev-docs-staging -- docs/dev
  60. # Commit (we use `|| true` because the commit could be empty and thus fail)
  61. git commit --message "Add developer docs from flameshot@$HASH" || true
  62. - name: Push to website repo
  63. working-directory: ${{github.workspace}}/website
  64. run: |
  65. git push --force destination dev-docs-staging
  66. git push destination gh-pages