Skip to content

Commit 9ce0d09

Browse files
Update the workflows to v2 (neo4j#2649)
This copies the PR neo4j#2542 --------- Co-authored-by: Neil Dewhurst <[email protected]>
1 parent c3f7a99 commit 9ce0d09

File tree

6 files changed

+131
-84
lines changed

6 files changed

+131
-84
lines changed

.github/workflows/docs-branch-checks.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
name: "Generate HTML"
3+
4+
# edit the list of branches according to your repository
5+
# the list of branches should contain all the branches in your Antora publish playbooks
6+
on:
7+
push:
8+
branches:
9+
- 'dev'
10+
- 'main'
11+
- '5.x'
12+
- '4.4'
13+
workflow_dispatch:
14+
15+
# change `dev` and `main` according to your repository's branch names
16+
# `dev` is the branch you use to build and publish to staging
17+
# `main` is the branch you use to build and publish to neo4j.com/docs
18+
# in some cases, PROD_BRANCH and DEV_BRANCH may be the same branch
19+
env:
20+
PROD_BRANCH: 'main'
21+
DEV_BRANCH: 'dev'
22+
23+
jobs:
24+
25+
prepare-ref-env:
26+
name: Set build branch and environments
27+
runs-on: ubuntu-latest
28+
outputs:
29+
build-ref: ${{ steps.set-ref-env.outputs.build-ref }}
30+
environments: ${{ steps.set-ref-env.outputs.environments }}
31+
steps:
32+
- name: Set Build Ref
33+
id: set-ref-env
34+
run: |
35+
if [[ "${GITHUB_REF}" == "refs/heads/${{ env.DEV_BRANCH }}" ]]; then
36+
build_from=${{ env.DEV_BRANCH }}
37+
environments='["dev"]'
38+
else
39+
build_from=${{ env.PROD_BRANCH }}
40+
environments='["prod"]'
41+
fi
42+
# if dev branch = prod branch publish to both
43+
if [[ "${{ env.DEV_BRANCH }}" == "${{ env.PROD_BRANCH }}" ]]; then
44+
environments='["dev","prod"]'
45+
fi
46+
echo "build-ref=${build_from}" >> $GITHUB_OUTPUT
47+
echo "environments=${environments[@]}" >> $GITHUB_OUTPUT
48+
49+
docs-build:
50+
name: Generate HTML
51+
needs: prepare-ref-env
52+
uses: neo4j/docs-tools/.github/workflows/reusable-docs-build.yml@v2
53+
with:
54+
package-script: 'verify:publish'
55+
build-ref: ${{needs.prepare-ref-env.outputs.build-ref}}
56+
fetch-depth: 0
57+
58+
docs-verify:
59+
name: Verify HTML
60+
needs: docs-build
61+
uses: neo4j/docs-tools/.github/workflows/reusable-docs-verify.yml@v2
62+
with:
63+
failOnWarnings: true
64+
65+
publish-html:
66+
name: Publish HTML
67+
needs: [docs-verify, prepare-ref-env]
68+
runs-on: ubuntu-latest
69+
70+
strategy:
71+
matrix:
72+
environments: ${{ fromJson(needs.prepare-ref-env.outputs.environments) }}
73+
74+
steps:
75+
- name: Publish to ${{ matrix.environments }}
76+
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2.1.2
77+
with:
78+
token: ${{ secrets.DOCS_DISPATCH_TOKEN }}
79+
repository: neo4j/docs-publish
80+
event-type: publish-html
81+
client-payload: |-
82+
{
83+
"org": "${{ github.repository_owner }}",
84+
"repo": "${{ github.event.repository.name }}",
85+
"run_id": "${{ github.run_id }}",
86+
"args": "--dryrun",
87+
"publish_env": "${{ matrix.environments }}"
88+
}

.github/workflows/docs-pr-checks.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,16 @@ jobs:
1313

1414
# Generate HTML
1515
docs-build-pr:
16-
uses: neo4j/docs-tools/.github/workflows/reusable-docs-build.yml@v1.2.0
16+
uses: neo4j/docs-tools/.github/workflows/reusable-docs-build.yml@v2
1717
with:
1818
deploy-id: ${{ github.event.number }}
19-
retain-artifacts: 14
2019

2120
# Parse the json log output from the HTML build, and output warnings and errors as annotations
2221
# Optionally, fail the build if there are warnings or errors
2322
# By default, the job fails if there are errors, passes if there are warnings only.
2423
docs-verify-pr:
2524
needs: docs-build-pr
26-
uses: neo4j/docs-tools/.github/workflows/reusable-docs-verify.yml@v1.2.0
25+
uses: neo4j/docs-tools/.github/workflows/reusable-docs-verify.yml@v2
2726
with:
2827
failOnWarnings: true
2928

@@ -55,7 +54,7 @@ jobs:
5554
docs-updates-comment-pr:
5655
if: needs.docs-build-pr.outputs.pages-listed == 'success'
5756
needs: [docs-build-pr, docs-changes-pr]
58-
uses: neo4j/docs-tools/.github/workflows/reusable-docs-pr-changes.yml@v1.2.0
57+
uses: neo4j/docs-tools/.github/workflows/reusable-docs-pr-changes.yml@v2
5958
with:
6059
pages-modified: ${{ needs.docs-changes-pr.outputs.pages-modified }}
61-
pages-added: ${{ needs.docs-changes-pr.outputs.pages-added }}
60+
pages-added: ${{ needs.docs-changes-pr.outputs.pages-added }}

package.json

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
11
{
2-
"name": "docs-template",
2+
"name": "docs-operations",
33
"version": "1.0.0",
4-
"description": "Template repo for Neo4j documentation projects",
4+
"description": "Neo4j Operations documentation",
55
"main": "server.js",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1",
8-
"start": "npm update && nodemon -e adoc --exec \"npm run build && npm run serve\"",
8+
"prestart": "npm update",
9+
"start": "nodemon --exec \"npm run build\"",
910
"serve": "node server.js",
10-
"adoc-gen": "node scripts/adoc-gen.js",
11-
"build": "antora preview.yml --stacktrace --log-format=pretty",
12-
"build-verify": "antora --stacktrace --fetch preview.yml --log-format=json --log-level=info --log-file ./build/log/log.json",
13-
"publish-verify": "antora --stacktrace --fetch publish.yml --log-format=json --log-file ./build/log/log.json"
11+
"clean": "rm -rf build",
12+
"build": "npm run build:preview",
13+
"postbuild": "node server.js",
14+
"build:preview": "antora preview.yml --stacktrace --log-format=pretty",
15+
"build:publish": "npm run clean && antora publish.yml --stacktrace --log-format=pretty",
16+
"verify:preview": "antora --stacktrace --fetch preview.yml --log-format=json --log-level=info --log-file ./build/log/log.json",
17+
"verify:publish": "antora --stacktrace --fetch publish.yml --log-format=json --log-level=info --log-file ./build/log/log.json"
1418
},
1519
"keywords": [
1620
"antora",
@@ -19,23 +23,31 @@
1923
"author": "Neo4j",
2024
"license": "ISC",
2125
"dependencies": {
22-
"@antora/cli": "^3.1.7",
23-
"@antora/site-generator-default": "^3.1.7",
24-
"@neo4j-antora/antora-add-notes": "^0.3.1",
25-
"@neo4j-antora/antora-modify-sitemaps": "^0.4.4",
26+
"antora": "3.1.14",
27+
"@neo4j-antora/antora-add-notes": "^0.3.2",
2628
"@neo4j-antora/antora-page-roles": "^0.3.2",
27-
"@neo4j-antora/antora-table-footnotes": "^0.3.2",
2829
"@neo4j-antora/antora-unlisted-pages": "^0.1.0",
29-
"@neo4j-documentation/macros": "^1.0.2",
30+
"@neo4j-antora/roles-labels": "^0.1.1",
31+
"@neo4j-antora/table-footnotes": "^1.0.0",
32+
"@neo4j-antora/xref-hash-validator": "^0.1.3",
33+
"@neo4j-documentation/macros": "^1.0.4",
3034
"@neo4j-documentation/remote-include": "^1.0.0"
3135
},
3236
"devDependencies": {
3337
"express": "^4.19.2",
3438
"nodemon": "^3.1.0"
3539
},
36-
"overrides": {
37-
"@antora/site-generator-default": {
38-
"glob-parent": "6.0.2"
39-
}
40+
"nodemonConfig": {
41+
"watch": [
42+
"**/modules/**",
43+
"**/antora.yml",
44+
"**/preview.yml",
45+
"**/publish.yml"
46+
],
47+
"ext": "yml,yaml,adoc,svg,png,jpg",
48+
"ignore": [
49+
"build",
50+
"node_modules"
51+
]
4052
}
4153
}

preview.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,17 @@ urls:
2424

2525
antora:
2626
extensions:
27-
- require: "@neo4j-antora/antora-modify-sitemaps"
28-
sitemap_version: '5'
29-
sitemap_loc_version: 'current'
30-
move_sitemaps_to_components: true
31-
- require: "@neo4j-antora/antora-unlisted-pages"
27+
- "@neo4j-antora/antora-unlisted-pages"
28+
- "@neo4j-antora/roles-labels"
29+
- "@neo4j-antora/table-footnotes"
30+
- "@neo4j-antora/xref-hash-validator"
3231

3332
asciidoc:
3433
extensions:
3534
- "@neo4j-documentation/remote-include"
3635
- "@neo4j-documentation/macros"
3736
- "@neo4j-antora/antora-add-notes"
3837
- "@neo4j-antora/antora-page-roles"
39-
- "@neo4j-antora/antora-table-footnotes"
4038
attributes:
4139
page-theme: docs
4240
page-type: Docs
@@ -51,7 +49,7 @@ asciidoc:
5149
includePDF: false
5250
nonhtmloutput: ""
5351
experimental: ''
54-
copyright: '2024'
52+
copyright: '2025'
5553
common-license-page-uri: https://neo4j.com/docs/license/
5654
check-mark: icon:check[]
5755
cross-mark: icon:times[]

publish.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,17 @@ urls:
2525

2626
antora:
2727
extensions:
28-
- require: "@neo4j-antora/antora-unlisted-pages"
28+
- "@neo4j-antora/antora-unlisted-pages"
29+
- "@neo4j-antora/roles-labels"
30+
- "@neo4j-antora/table-footnotes"
31+
- "@neo4j-antora/xref-hash-validator"
2932

3033
asciidoc:
3134
extensions:
3235
- "@neo4j-documentation/remote-include"
3336
- "@neo4j-documentation/macros"
3437
- "@neo4j-antora/antora-add-notes"
3538
- "@neo4j-antora/antora-page-roles"
36-
- "@neo4j-antora/antora-table-footnotes"
3739
attributes:
3840
page-theme: docs
3941
page-type: Docs
@@ -48,7 +50,7 @@ asciidoc:
4850
includePDF: false
4951
nonhtmloutput: ""
5052
experimental: ''
51-
copyright: '2024'
53+
copyright: '2025'
5254
common-license-page-uri: https://neo4j.com/docs/license/
5355
check-mark: icon:check[]
5456
cross-mark: icon:times[]

0 commit comments

Comments
 (0)