From f54e7cbd348e61f2700e6cb0baea5e7a6d007898 Mon Sep 17 00:00:00 2001 From: Neil Dewhurst Date: Thu, 3 Nov 2022 16:37:04 +0000 Subject: [PATCH] Add GHA workflows --- .github/workflows/docs-deploy-surge.yml | 67 +++++++++++++++++++++++++ .github/workflows/docs-pr.yml | 28 +++++++++++ .github/workflows/docs-teardown.yml | 26 ++++++++++ 3 files changed, 121 insertions(+) create mode 100644 .github/workflows/docs-deploy-surge.yml create mode 100644 .github/workflows/docs-pr.yml create mode 100644 .github/workflows/docs-teardown.yml diff --git a/.github/workflows/docs-deploy-surge.yml b/.github/workflows/docs-deploy-surge.yml new file mode 100644 index 000000000..764b0b850 --- /dev/null +++ b/.github/workflows/docs-deploy-surge.yml @@ -0,0 +1,67 @@ +# 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" +# 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 +name: "Deploy to surge" + +on: + workflow_run: + workflows: ["Verify PR"] + types: + - completed + +jobs: + publish-docs: + if: github.event.workflow_run.conclusion == 'success' + + runs-on: ubuntu-latest + + steps: + - name: "Download built documentation" + uses: actions/github-script@v6.0.0 + with: + script: | + var artifacts = await github.rest.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }}, + }); + var matchArtifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "docs" + })[0]; + var download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{ github.workspace }}/docs.zip', Buffer.from(download.data)); + + - run: unzip docs.zip + + - id: get-deploy-id + run: | + deployid=$(