From e2399cbea332d69c4fcfe3d52aa1123ceb7ad8e8 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Thu, 21 Nov 2024 17:16:54 +0000 Subject: [PATCH 1/3] add docs-publish workflow --- .github/workflows/docs-publish.yml | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/docs-publish.yml diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml new file mode 100644 index 00000000..b4d31306 --- /dev/null +++ b/.github/workflows/docs-publish.yml @@ -0,0 +1,56 @@ + +name: "Publish Branch" + +on: + push: + branches: + - 'dev' + - '5.x' + workflow_dispatch: + # schedule: + # - cron: '00 16 * * *' + +env: + PUBLISH_TO: ${{ github.ref == 'refs/heads/5.x' && 'prod' || 'dev' }} + +jobs: + + # Generate HTML + docs-build: + uses: neo4j/docs-tools/.github/workflows/reusable-docs-build.yml@v1.1.2 + with: + deploy-id: 0 + retain-artifacts: 14 + + # Parse the json log output from the HTML build, and output warnings and errors as annotations + # Optionally, fail the build if there are warnings or errors + # By default, the job fails if there are errors, passes if there are warnings only. + docs-verify: + needs: docs-build + uses: neo4j/docs-tools/.github/workflows/reusable-docs-verify.yml@v1.1.2 + with: + failOnWarnings: true + + trigger-publish: + needs: docs-verify + runs-on: ubuntu-latest + + steps: + - name: Trigger Publish + uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 + with: + token: ${{ secrets.DOCS_DISPATCH_TOKEN }} + repository: neo4j/docs-publish + event-type: ${{ github.event.repository.name }} + client-payload: |- + { + "org": "${{ github.repository_owner }}", + "repo": "${{ github.event.repository.name }}", + "run_id": "${{ github.run_id }}", + "branch": "${{ github.ref_name }}", + "args": "--dryrun", + "publish_env": "${{ env.PUBLISH_TO }}", + "docsets": [ + "status-codes" + ] + } From 27584e39a9298a6fee7c60763f88dc10050bf18e Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Fri, 22 Nov 2024 11:28:43 +0000 Subject: [PATCH 2/3] Use publish-verify-script --- .github/workflows/docs-publish.yml | 5 +++-- package.json | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index b4d31306..bee903cc 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -19,8 +19,9 @@ jobs: docs-build: uses: neo4j/docs-tools/.github/workflows/reusable-docs-build.yml@v1.1.2 with: - deploy-id: 0 - retain-artifacts: 14 + deploy-id: ${{ github.run_id }} + retain-artifacts: 28 + package-script: 'publish-verify' # Parse the json log output from the HTML build, and output warnings and errors as annotations # Optionally, fail the build if there are warnings or errors diff --git a/package.json b/package.json index 16f39e43..0c41faeb 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "serve": "node server.js", "build": "antora --stacktrace preview.yml", "build-verify": "antora --stacktrace --fetch preview.yml --log-format=json --log-level=info --log-file ./build/log/log.json", - "publish-verify": "antora --stacktrace --fetch publish.yml --log-format=json --log-file ./build/log/log.json" + "publish-verify": "antora --stacktrace --fetch publish.yml --log-format=json --log-level=info --log-file ./build/log/log.json" }, "repository": { "type": "git", From c3687117f6915591894afd1be3de84085ec27064 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Fri, 22 Nov 2024 12:17:03 +0000 Subject: [PATCH 3/3] avoid deploy-id bug --- .github/workflows/docs-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-publish.yml b/.github/workflows/docs-publish.yml index bee903cc..36e4e76f 100644 --- a/.github/workflows/docs-publish.yml +++ b/.github/workflows/docs-publish.yml @@ -19,7 +19,7 @@ jobs: docs-build: uses: neo4j/docs-tools/.github/workflows/reusable-docs-build.yml@v1.1.2 with: - deploy-id: ${{ github.run_id }} + deploy-id: 0 retain-artifacts: 28 package-script: 'publish-verify'