website.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. name: Update website
  2. concurrency:
  3. group: mesonbuild.com
  4. # We do NOT want `cancel-in-progress` here since only one website job
  5. # should run at a time to avoid upload race conditions.
  6. on:
  7. push:
  8. branches:
  9. - master
  10. paths:
  11. - docs/**
  12. pull_request:
  13. paths:
  14. - docs/**
  15. workflow_dispatch:
  16. release:
  17. types:
  18. - published
  19. permissions:
  20. contents: write # for release creation (svenstaro/upload-release-action)
  21. # This job is copy/paster into wrapdb CI, please update it there when doing any
  22. # change here.
  23. jobs:
  24. update_website:
  25. env:
  26. HAS_SSH_KEY: ${{ secrets.WEBSITE_PRIV_KEY != '' }}
  27. runs-on: ubuntu-latest
  28. steps:
  29. - uses: actions/checkout@v3
  30. - name: Install package
  31. run: |
  32. sudo apt-get -y install python3-pip ninja-build libjson-glib-dev
  33. pip install hotdoc chevron strictyaml
  34. - name: Setup SSH Keys and known_hosts
  35. env:
  36. SSH_AUTH_SOCK: /tmp/ssh_agent.sock
  37. run: |
  38. ssh-agent -a $SSH_AUTH_SOCK > /dev/null
  39. ssh-add - <<< "${{ secrets.WEBSITE_PRIV_KEY }}"
  40. if: env.HAS_SSH_KEY == 'true'
  41. - name: Build website
  42. run: |
  43. git config --global user.name "github-actions"
  44. git config --global user.email "github-actions@github.com"
  45. cd docs
  46. ../meson.py setup _build
  47. ninja -C _build
  48. ninja -C _build test
  49. - name: Update website
  50. env:
  51. SSH_AUTH_SOCK: /tmp/ssh_agent.sock
  52. run: |
  53. cd docs
  54. ninja -C _build upload
  55. if: env.HAS_SSH_KEY == 'true'
  56. - name: Release the current JSON docs
  57. uses: svenstaro/upload-release-action@v2
  58. with:
  59. repo_token: ${{ secrets.GITHUB_TOKEN }}
  60. file: docs/_build/reference_manual.json
  61. tag: ${{ github.ref }}
  62. if: ${{ github.event_name == 'release' }}
  63. - name: Release the current man docs
  64. uses: svenstaro/upload-release-action@v2
  65. with:
  66. repo_token: ${{ secrets.GITHUB_TOKEN }}
  67. file: docs/_build/meson-reference.3
  68. tag: ${{ github.ref }}
  69. if: ${{ github.event_name == 'release' }}