Skip to content

Commit

Permalink
Update workflow for #19
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
aj-stein-nist committed Sep 22, 2023
1 parent dbf6646 commit 5cd9afb
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
Expand Down

0 comments on commit 5cd9afb

Please sign in to comment.