main.yml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. # This file can be used to configure the Node.js build for Antora ci without
  2. # having Node installed locally. See 'transition-docs/antora_setup.adoc' in the root
  3. # of this repo for details of how to use this file.
  4. #
  5. # The action add-and-commit will always commit the package-lock.json,
  6. # package.json and Antora cache only if changes are made to the files.
  7. #
  8. # If the package-lock.json or package.json files are updated or new depends are
  9. # installed, the 'npm ci' should be always ran thereafter to speed up build
  10. # times. When ci is active, the package-lock.json and package.json files in root
  11. # will not be updated.
  12. #
  13. # Uses the action actions-gh-page to publish pages to the gh-pages branch,
  14. # including a required .nojekyll file that Antora requires for configuration.
  15. #
  16. # The 'actions/cache@v2' creates a new cache when the packages in
  17. # package-lock.json file change, or when the workflow runner's operating system
  18. # changes.
  19. name: Build Docs
  20. on:
  21. push:
  22. branches: '*'
  23. # Initiate a build to pull in the wiki-ui repository changes.
  24. repository_dispatch:
  25. types: [wiki-ui-build]
  26. pull_request:
  27. jobs:
  28. build:
  29. #Static version is used to maintain stability.
  30. runs-on: ubuntu-18.04
  31. strategy:
  32. matrix:
  33. #Static version is used to maintain stability.
  34. node-version: [12.17.0]
  35. steps:
  36. - name: Clone the repo
  37. uses: actions/checkout@v2
  38. with:
  39. # Number of commits to fetch. 0 indicates all history.
  40. fetch-depth: 1
  41. - name: Use Node.js ${{ matrix.node-version }}
  42. uses: actions/setup-node@v1
  43. with:
  44. node-version: ${{ matrix.node-version }}
  45. # Display the sha of the build triggering the repository_dispatch event.
  46. - name: wiki-ui-build
  47. if: github.event.action == 'wiki-ui-build'
  48. run: echo wiki-ui-build sha ${{ github.event.client_payload.sha }}
  49. # Uncomment to write the default package.json file to the repo root.
  50. # When used in conjunction with the action add-and-commit 'add' command, the
  51. # file will be written to the repo for editing.
  52. # - name: Install default package.json
  53. # run: npm init --yes
  54. # Uncomment when adding or updating dependencies in the package-lock.json
  55. # and package.json files for ci.
  56. # - name: Install Node
  57. # run: npm i
  58. # Uncomment during initial setup or when updating Antora to a new version.
  59. # The action add-and-commit 'add' command will detect the changes and commit
  60. # the package-lock.json and package.json files.
  61. # Emoji support. Seems to be a direct implementation of AsciiDoctor ruby
  62. # extension.
  63. # see: https://github.com/mogztter/asciidoctor-emoji
  64. # - name: Install Antora
  65. # run: |
  66. # npm i @antora/[email protected]
  67. # npm i @antora/[email protected]
  68. # npm i asciidoctor-emoji
  69. # Uncomment after package-lock.json and package.json files are updated.
  70. - name: Run with CI
  71. run: npm ci
  72. - name: Audit Depends
  73. run: npm audit
  74. - name: Build Docs
  75. run: npm run buildDocs
  76. # Detects any updates to package-lock.json and package.json and commits the
  77. # files to root.
  78. # see:
  79. # https://github.com/marketplace/actions/add-commit?version=v4.1.0
  80. # for use options.
  81. - name: Commit Packages
  82. uses: EndBug/add-and-commit@v4
  83. with:
  84. author_name: mitm001
  85. author_email: [email protected]
  86. message: "Commit files for CI workflow"
  87. # Commits these files to root if and only if there are changes.
  88. add: "package-lock.json package.json ./.cache/antora/*"
  89. env:
  90. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  91. # Antora will not copy folders outside the family tree so we move the
  92. # resources into the build/site folder so the peaceiris action will commit
  93. # the files.
  94. - name: Copy Tutorials
  95. run: cp -r ./docs/modules/ROOT/resources/* ./build/site/
  96. # Commit changes to the gh-pages branch. Antora requires an empty
  97. # '.nojekyll' be present in the branch due to certain directories starting
  98. # with an underscore. This action has an option, set by default, to add that
  99. # file for us on commit.
  100. # see:
  101. # https://github.com/marketplace/actions/github-pages-action?version=v3.6.1
  102. # for use options.
  103. - name: Deploy Docs
  104. uses: peaceiris/actions-gh-pages@v3
  105. with:
  106. github_token: ${{ secrets.GITHUB_TOKEN }}
  107. # Commits these files to gh-pages if and only if there are changes.
  108. publish_dir: ./build/site
  109. # Insert CNAME for repository.
  110. cname: wiki.jmonkeyengine.org