main.yml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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: [ modules ]
  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. env:
  36. ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }}
  37. ALGOLIA_IDX_NAME: ${{ secrets.ALGOLIA_IDX_NAME }}
  38. steps:
  39. - name: Clone the repo
  40. uses: actions/checkout@v2
  41. with:
  42. ref: modules
  43. # Number of commits to fetch. 0 indicates all history.
  44. fetch-depth: 1
  45. - name: Use Node.js ${{ matrix.node-version }}
  46. uses: actions/setup-node@v1
  47. with:
  48. node-version: ${{ matrix.node-version }}
  49. # Display the sha of the build triggering the repository_dispatch event.
  50. - name: wiki-ui-build
  51. if: github.event.action == 'wiki-ui-build'
  52. run: echo wiki-ui-build sha ${{ github.event.client_payload.sha }}
  53. # Uncomment to write the default package.json file to the repo root.
  54. # When used in conjunction with the action add-and-commit 'add' command, the
  55. # file will be written to the repo for editing.
  56. # - name: Install default package.json
  57. # run: npm init --yes
  58. # Uncomment when adding or updating dependencies in the package-lock.json
  59. # and package.json files for ci.
  60. # - name: Install Node
  61. # run: npm i
  62. # Uncomment during initial setup or when updating Antora to a new version.
  63. # The action add-and-commit 'add' command will detect the changes and commit
  64. # the package-lock.json and package.json files.
  65. # Emoji support. Seems to be a direct implementation of AsciiDoctor ruby
  66. # extension.
  67. # see: https://github.com/mogztter/asciidoctor-emoji
  68. # - name: Install Antora
  69. # run: |
  70. # npm i @antora/[email protected]
  71. # npm i @antora/[email protected]
  72. # npm i asciidoctor-emoji
  73. # Uncomment after package-lock.json and package.json files are updated.
  74. - name: Run with CI
  75. run: npm ci
  76. - name: Audit Depends
  77. run: npm audit
  78. - name: Build Docs
  79. run: npm run buildDocs
  80. # Detects any updates to package-lock.json and package.json and commits the
  81. # files to root.
  82. # see:
  83. # https://github.com/marketplace/actions/add-commit?version=v4.1.0
  84. # for use options.
  85. - name: Commit Packages
  86. uses: EndBug/add-and-commit@v4
  87. with:
  88. author_name: mitm001
  89. author_email: [email protected]
  90. message: "Commit files for CI workflow"
  91. # Commits these files to root if and only if there are changes.
  92. add: "package-lock.json package.json ./.cache/antora/*"
  93. env:
  94. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  95. # Antora will not copy folders outside the family tree so we move the
  96. # resources into the build/site folder so the peaceiris action will commit
  97. # the files.
  98. - name: Copy Tutorials
  99. run: cp -r ./docs/modules/ROOT/resources/* ./build/site/
  100. # Commit changes to the gh-pages branch. Antora requires an empty
  101. # '.nojekyll' be present in the branch due to certain directories starting
  102. # with an underscore. This action has an option, set by default, to add that
  103. # file for us on commit.
  104. # see:
  105. # https://github.com/marketplace/actions/github-pages-action?version=v3.6.1
  106. # for use options.
  107. - name: Deploy Docs
  108. uses: peaceiris/actions-gh-pages@v3
  109. with:
  110. github_token: ${{ secrets.GITHUB_TOKEN }}
  111. # Commits these files to gh-pages if and only if there are changes.
  112. publish_dir: ./build/site
  113. # Insert CNAME for repository.
  114. cname: wiki.jmonkeyengine.org