diff --git a/.github/workflows/docs-deploy-surge.yml b/.github/workflows/docs-deploy-surge.yml index e75b855..2399928 100644 --- a/.github/workflows/docs-deploy-surge.yml +++ b/.github/workflows/docs-deploy-surge.yml @@ -1,16 +1,18 @@ # Use this starter workflow to deploy HTML generated by Antora to surge.sh # Docs are published at --.surge.sh - -# By default, this workflow runs on completion of a workflow called "Verify PR" - +# +# By default, this workflow runs on completion of a workflow called "Verify docs PR" +# # This workflow expects the triggering workflow to generate an artifact called "docs" # - update the reference to "docs" and "docs.zip" in this workflow if your triggering workflow generates an artifact with a different name +# change to force workflow with no changelog + name: "Deploy docs preview" on: workflow_run: - workflows: ["Verify Docs PR"] + workflows: ["Verify docs PR"] types: - completed @@ -23,7 +25,7 @@ jobs: steps: - name: "Download built documentation" - uses: actions/github-script@v6.4.1 + uses: actions/github-script@v7 env: RUN_ID: ${{ github.event.workflow_run.id }} WORKSPACE: ${{ github.workspace }} @@ -34,19 +36,41 @@ jobs: repo: context.repo.repo, run_id: ${{ env.RUN_ID }}, }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { + + var matchArtifactDocs = artifacts.data.artifacts.filter((artifact) => { return artifact.name == "docs" })[0]; - var download = await github.rest.actions.downloadArtifact({ + var downloadDocs = await github.rest.actions.downloadArtifact({ owner: context.repo.owner, repo: context.repo.repo, - artifact_id: matchArtifact.id, + artifact_id: matchArtifactDocs.id, archive_format: 'zip', }); var fs = require('fs'); - fs.writeFileSync('${{ env.WORKSPACE }}/docs.zip', Buffer.from(download.data)); - - - run: unzip docs.zip + fs.writeFileSync('${{ env.WORKSPACE }}/docs.zip', Buffer.from(downloadDocs.data)); + + var matchArtifactChangelog = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "changelog" + })[0]; + var downloadChangelog = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifactChangelog.id, + archive_format: 'zip', + }); + fs.writeFileSync('${{ env.WORKSPACE }}/changelog.zip', Buffer.from(downloadChangelog.data)); + + - id: unzip-docs + run: unzip docs.zip + + - id: get-top-dir + run: | + root=$(ls -d */index.html | sed -r 's/(.*)\/index\.html/\1/') + echo "top-dir=$root" >> $GITHUB_OUTPUT + + - id: unzip-changelog + if: ${{ hashFiles('changelog.zip') != '' }} + run: unzip changelog.zip - id: get-deploy-id run: | @@ -63,7 +87,7 @@ jobs: deployurl=$ORG-$REPO-$DEPLOYID.surge.sh echo "deploy-url=$deployurl" >> $GITHUB_OUTPUT - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: lts/* @@ -72,15 +96,16 @@ jobs: env: DEPLOY_URL: ${{ steps.get-deploy-url.outputs.deploy-url }} SURGE_TOKEN: "${{ secrets.DOCS_SURGE_TOKEN }}" + SITE_DIR: ${{ steps.get-top-dir.outputs.top-dir }} run: | npm install -g surge - surge ./site $DEPLOY_URL --token "$SURGE_TOKEN" + surge ./$SITE_DIR $DEPLOY_URL --token "$SURGE_TOKEN" # If the PR artifacts include a changelog file, add it to the PR as a comment # The changelog contains links to new and changed files in the deployed docs - name: Comment on PR (changelog) if: ${{ hashFiles('changelog') != '' }} - uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd #v2.8.0 + uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 #v2.9.0 with: number: ${{ steps.get-deploy-id.outputs.deploy-id }} recreate: true @@ -93,7 +118,7 @@ jobs: if: ${{ hashFiles('changelog') == '' }} env: DEPLOY_URL: ${{ steps.get-deploy-url.outputs.deploy-url }} - uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd #v2.8.0 + uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 #v2.9.0 with: number: ${{ steps.get-deploy-id.outputs.deploy-id }} header: docs-pr-changes @@ -102,4 +127,3 @@ jobs: Check out your changes at https://${{ env.DEPLOY_URL }} GITHUB_TOKEN: ${{ secrets.DOCS_PR_COMMENT_TOKEN }} - diff --git a/.github/workflows/docs-pr-checks.yml b/.github/workflows/docs-pr-checks.yml index 7c948fa..53bce7e 100644 --- a/.github/workflows/docs-pr-checks.yml +++ b/.github/workflows/docs-pr-checks.yml @@ -1,19 +1,19 @@ -name: "Verify Docs PR" +name: "Verify docs PR" on: pull_request: branches: - - "dev" - - "5.x" - - "4.[0-9]" - - "3.5" + - 'main' + - 'dev' + - '5.x' + - '4.4' jobs: # Generate HTML docs-build-pr: - uses: neo4j/docs-tools/.github/workflows/reusable-docs-build.yml@v1.0.3 + uses: neo4j/docs-tools/.github/workflows/reusable-docs-build.yml@v1.2.0 with: deploy-id: ${{ github.event.number }} retain-artifacts: 14 @@ -23,7 +23,7 @@ jobs: # By default, the job fails if there are errors, passes if there are warnings only. docs-verify-pr: needs: docs-build-pr - uses: neo4j/docs-tools/.github/workflows/reusable-docs-verify.yml@v1.0.3 + uses: neo4j/docs-tools/.github/workflows/reusable-docs-verify.yml@v1.2.0 with: failOnWarnings: true @@ -55,7 +55,7 @@ jobs: docs-updates-comment-pr: if: needs.docs-build-pr.outputs.pages-listed == 'success' needs: [docs-build-pr, docs-changes-pr] - uses: neo4j/docs-tools/.github/workflows/reusable-docs-pr-changes.yml@v1.0.3 + uses: neo4j/docs-tools/.github/workflows/reusable-docs-pr-changes.yml@v1.2.0 with: pages-modified: ${{ needs.docs-changes-pr.outputs.pages-modified }} - pages-added: ${{ needs.docs-changes-pr.outputs.pages-added }} \ No newline at end of file + pages-added: ${{ needs.docs-changes-pr.outputs.pages-added }} diff --git a/.github/workflows/docs-teardown.yml b/.github/workflows/docs-teardown.yml index 510abb3..e21cc3a 100644 --- a/.github/workflows/docs-teardown.yml +++ b/.github/workflows/docs-teardown.yml @@ -4,10 +4,10 @@ name: "Documentation Teardown" on: pull_request_target: branches: - - "dev" - - "5.x" - - "4.[0-9]" - - "3.5" + - 'main' + - 'dev' + - '5.x' + - '4.4' types: - closed @@ -16,7 +16,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: lts/* @@ -39,7 +39,7 @@ jobs: surge teardown $DEPLOY_URL --token "$SURGE_TOKEN" - name: Comment on PR - uses: marocchino/sticky-pull-request-comment@efaaab3fd41a9c3de579aba759d2552635e590fd # v2.8.0 + uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 #v2.9.0 with: number: ${{ github.event.pull_request.number }} header: docs-pr-changes @@ -48,4 +48,4 @@ jobs: The preview documentation has now been torn down - reopening this PR will republish it. GITHUB_TOKEN: ${{ secrets.DOCS_PR_COMMENT_TOKEN }} - +