-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from playframework/antora
Reusable workflow for Antora
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Generate documentation with Antora | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
path: | ||
type: string | ||
required: false | ||
default: './' | ||
playbook: | ||
type: string | ||
required: false | ||
default: 'local-antora-playbook.yml' | ||
publish: | ||
type: boolean | ||
required: false | ||
default: false | ||
|
||
jobs: | ||
docs: | ||
name: Antora | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves | ||
fetch-depth: 0 | ||
|
||
- name: Install NodeJS | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- name: Get npm cache directory | ||
id: npm-cache-dir | ||
run: | | ||
echo "::set-output name=dir::$(npm config get cache)" | ||
- uses: actions/cache@v3 | ||
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' | ||
with: | ||
path: ${{ steps.npm-cache-dir.outputs.dir }} | ||
key: ${{ runner.os }}-node-antora@3.1.1-lunr-extension@1.0.0-alpha.8 | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
- name: Install Antora and extensions | ||
run: npm i -D -E --quiet --no-progress @antora/cli@3.1.1 @antora/site-generator@3.1.1 @antora/lunr-extension@1.0.0-alpha.8 | ||
working-directory: ${{ inputs.path }} | ||
|
||
- name: Build documentation | ||
run: npx antora ${{ inputs.playbook }} | ||
working-directory: ${{ inputs.path }} | ||
|
||
- name: Publish to GitHub Pages | ||
if: ${{ inputs.publish }} | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ${{ inputs.path }}/build/site | ||
force_orphan: true | ||
commit_message: "Deploy docs" | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters