main.yml 4.6 KB

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