From 5cd9afbba6fa1d98329063e7723c788e34434c9f Mon Sep 17 00:00:00 2001 From: "A.J. Stein" Date: Fri, 22 Sep 2023 14:23:40 -0400 Subject: [PATCH] Update workflow for #19 This will update the workflow to allow the following: 1. Override the revisions and not compute them. 1. Override the prefix and ignore overridden revisions. 1. The default, add prototype* as a prefix for publication from the usnistgov/OSCAL repo. In the case the last scenario is not desired, a developer with admin permissions in the repository can provide a '' prefix and all prototype prefix branches go away and will be silently ignored. --- .github/workflows/pages.yaml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pages.yaml b/.github/workflows/pages.yaml index ce7ee5083..2a022b32c 100644 --- a/.github/workflows/pages.yaml +++ b/.github/workflows/pages.yaml @@ -4,8 +4,21 @@ on: branches: - main pull_request: {} + workflow_dispatch: + inputs: + revisions: + description: 'Override the computed list of tags and branches with a space-separated list of tags and branches, in order from first to last.' + required: false + prefix: + description: 'Provide a prefix for experimental branches that need to be published alongside tags. It is ignored if revisions is overriden.' + required: false + type: string jobs: deploy: + env: + REVISIONS: ${{ github.event.inputs.revisions != '' && github.event.inputs.revisions || format('{0}', 'unset') }} + # the default of is set below so it continue to work whether or not it is an interactive workflow dispatch or not. + PROTOTYPE_BRANCHES_PREFIX: ${{ github.event.inputs.prefix != '' && github.event.inputs.prefix || format('{0}', 'prototype') }} runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 @@ -46,7 +59,12 @@ jobs: - name: Build # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources # GHA runners have 2 CPUs - run: make site -j2 + if: env.REVISIONS == 'unset' + run: make site -j2 PROTOTYPE_BRANCHES_PREFIX="${{ env.PROTOTYPE_BRANCHES_PREFIX }}" + - name: Build (revisions overriden) + # override revisions and prototype branch prefix ignored + if: env.REVISIONS != 'unset' + run: make site -j2 REVISIONS="${{ env.REVISIONS }}" - name: Deploy uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 if: github.ref == 'refs/heads/main'