Add caching to docs-build

Closes gh-40104
This commit is contained in:
Phillip Webb 2024-03-29 17:43:19 -07:00
parent 669a1eecd5
commit 67277f484d
2 changed files with 14 additions and 3 deletions

View File

@ -28,6 +28,15 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 20
- name: Check Out 'package.json' From Main
run: node run.js --only-checkout
- name: Cache Files
uses: actions/cache@v4
with:
key: antora-${{ hashFiles('package-lock.json', 'antora-playbook.yml') }}
path: |
~/.npm
~/.cache/antora
- name: Install and Run Antora
env:
ALGOLIA_APP_ID: 244V8V9FGG
@ -37,7 +46,7 @@ jobs:
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
REFERENCE: ${{ github.event.inputs.build-refname }}
BUILD_VERSION: ${{ github.event.inputs.build-version }}
run: node run.js
run: node run.js --no-checkout
- name: Sync Documentation
uses: spring-io/spring-doc-actions/rsync-antora-reference@v0.0.15
with:

6
run.js
View File

@ -7,8 +7,10 @@
async function main() {
try {
checkout(process.argv.includes('--no-checkout'))
install(process.argv.includes('--no-install'))
run(process.argv.includes('--no-run'))
if (!process.argv.includes('--only-checkout')) {
install(process.argv.includes('--no-install'))
run(process.argv.includes('--no-run'))
}
} catch (error) {
console.log("Unexpected error")
process.exitCode = (error.exitCode) ? error.exitCode : 1