Bump untitaker/hyperlink from 0.1.15 to 0.1.29 #28
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: | |
branches: | |
- main | |
name: Build Artifacts and Documentation | |
env: | |
# the name of the repo | |
HOME_REPO: usnistgov/OSCAL | |
HOME_BRANCH: main | |
# dependency versions | |
SAXON_VERSION: 9.9.0-1 | |
HUGO_VERSION: 0.69.2 | |
# build-specific environment | |
CONTENT_CONFIG_PATH: src/config | |
SCHEMATRON_HOME: git-content/schematron | |
OSCAL_HOME: git-content/oscal | |
OSCAL_CICD_PATH: git-content/oscal/build/ci-cd | |
OSCAL_WORKING_PATH: git-content/oscal | |
OSCAL_WEBSITE_PATH: git-content/oscal/docs | |
OSCAL_SCRATCH_PATH: oscal-scratch | |
jobs: | |
check-skip: | |
runs-on: ubuntu-latest | |
outputs: | |
skip: ${{ steps.ci-skip-step.outputs.ci-skip }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- id: ci-skip-step | |
uses: mstachniuk/ci-skip@v1 | |
build-and-publish-metaschema-artifacts: | |
name: Produce Metaschema Artifacts | |
needs: check-skip | |
if: ${{ needs.check-skip.outputs.skip == 'false' }} | |
runs-on: ubuntu-18.04 | |
steps: | |
# use this for main repo master builds | |
- uses: actions/checkout@v2 | |
if: ${{ github.repository == env.HOME_REPO && github.ref == format('refs/heads/{0}',env.HOME_BRANCH) }} | |
with: | |
path: ${{ env.OSCAL_HOME }} | |
submodules: recursive | |
token: ${{ secrets.COMMIT_TOKEN }} | |
# use this for pull request builds where checkout uses the builtin token | |
- uses: actions/checkout@v2 | |
if: ${{ github.repository != env.HOME_REPO || github.ref != format('refs/heads/{0}',env.HOME_BRANCH) }} | |
with: | |
path: ${{ env.OSCAL_HOME }} | |
submodules: recursive | |
# Setup runtime environment | |
# ------------------------- | |
# Java JDK 11 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11 | |
distribution: 'adopt' | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2- | |
- name: Get Saxon-HE | |
run: | | |
mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DartifactId=Saxon-HE -DgroupId=net.sf.saxon -Dversion=$SAXON_VERSION | |
# Schematron | |
- name: Install the schematron skeleton | |
run: | | |
git clone --depth 1 --no-checkout https://github.com/Schematron/schematron.git "$SCHEMATRON_HOME" | |
cd "${SCHEMATRON_HOME}" | |
git checkout master -- trunk/schematron/code | |
# Operating System packages | |
- name: Update APT package metadata | |
run: | | |
sudo rm -rf /var/lib/apt/lists/* && sudo apt-get update | |
- name: Install APT dependencies | |
run: | | |
sudo apt-get install libxml2-utils | |
# NodeJS | |
- name: Install NPM dependencies (i.e., ajv) | |
run: | | |
sudo npm install --loglevel verbose -g yargs ajv-formats@"^1.5.x" ajv-cli@"^4.0.x" yaml-convert@"^1.0.x" | |
# Build Artifacts | |
# --------------- | |
# job-validate-metaschema | |
- name: Validate Metaschemas | |
run: | | |
bash "${OSCAL_CICD_PATH}/validate-metaschema.sh" -w "${OSCAL_WORKING_PATH}" --scratch-dir "${OSCAL_SCRATCH_PATH}" | |
# job-generate-schema | |
- name: Generate Schemas | |
run: | | |
bash "${OSCAL_CICD_PATH}/generate-schema.sh" -w "${OSCAL_WORKING_PATH}" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: schemas | |
path: | | |
${{ env.OSCAL_WORKING_PATH }}/xml/schema/*.xsd | |
${{ env.OSCAL_WORKING_PATH }}/json/schema/*.json | |
retention-days: 5 | |
# job-generate-converters | |
- name: Generate Content Converters | |
run: | | |
bash "${OSCAL_CICD_PATH}/generate-content-converters.sh" -w "${OSCAL_WORKING_PATH}" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: content-converters | |
path: | | |
${{ env.OSCAL_WORKING_PATH }}/xml/convert/*.xsl | |
${{ env.OSCAL_WORKING_PATH }}/json/convert/*.xsl | |
retention-days: 5 | |
# job-run-unittests | |
- name: Run Content Unit Tests | |
run: | | |
bash "${OSCAL_CICD_PATH}/run-unittests.sh" -w "${OSCAL_WORKING_PATH}" | |
# Store Built Artifacts | |
# --------------- | |
- name: Publish Artifacts | |
# only do this on master | |
if: ${{ github.repository == env.HOME_REPO && github.ref == format('refs/heads/{0}',env.HOME_BRANCH) }} | |
uses: stefanzweifel/git-auto-commit-action@v4.9.2 | |
with: | |
repository: ${{ env.OSCAL_HOME }} | |
file_pattern: xml json | |
# push_options: --force-with-lease | |
skip_dirty_check: false | |
commit_message: Publishing auto-converted artifacts [ci skip] | |
commit_user_name: OSCAL GitHub Actions Bot | |
commit_user_email: oscal@nist.gov | |
commit_author: OSCAL GitHub Actions Bot <oscal@nist.gov> | |
validate-repo-markdown: | |
name: Validate Repo Markdown Content | |
needs: check-skip | |
if: ${{ needs.check-skip.outputs.skip == 'false' }} | |
runs-on: ubuntu-18.04 | |
steps: | |
# use this for pulls where checkout is anonymous | |
- uses: actions/checkout@v2 | |
with: | |
path: ${{ env.OSCAL_HOME }} | |
submodules: recursive | |
# Setup runtime environment | |
# ------------------------- | |
- name: Get markdown-link-check | |
run: | | |
sudo npm install -g markdown-link-check | |
# Build Artifacts | |
# --------------- | |
- name: Validate repo Markdown content instances | |
run: | | |
cd "$OSCAL_HOME" | |
# this command will filter out any docs Markdown files, which are checked in a different job | |
git ls-files "*/*.md" -z | grep --null-data -v "^docs/" | xargs -0 -n1 markdown-link-check -q -c "build/config/.markdown-link-check/config.json" | |
build-and-publish-website: | |
name: Build and Publish Website | |
needs: build-and-publish-metaschema-artifacts | |
runs-on: ubuntu-18.04 | |
steps: | |
# use this for main repo master builds | |
- uses: actions/checkout@v2 | |
if: ${{ github.repository == env.HOME_REPO && github.ref == format('refs/heads/{0}',env.HOME_BRANCH) }} | |
with: | |
path: ${{ env.OSCAL_HOME }} | |
submodules: recursive | |
token: ${{ secrets.COMMIT_TOKEN }} | |
- name: Get latest from repo | |
if: ${{ github.repository == env.HOME_REPO && github.ref == format('refs/heads/{0}',env.HOME_BRANCH) }} | |
# This will ensure that any files committed by the previous job, will be updated | |
run: | | |
git pull --ff-only | |
working-directory: ${{ env.OSCAL_HOME }} | |
# use this for pull request builds where checkout uses the builtin token | |
- uses: actions/checkout@v2 | |
if: ${{ github.repository != env.HOME_REPO || github.ref != format('refs/heads/{0}',env.HOME_BRANCH) }} | |
with: | |
path: ${{ env.OSCAL_HOME }} | |
submodules: recursive | |
# Setup runtime environment | |
# ------------------------- | |
# Operating System packages | |
- name: Update APT package metadata | |
run: | | |
sudo rm -rf /var/lib/apt/lists/* && sudo apt-get update | |
# Java JDK 11 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11 | |
distribution: 'adopt' | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2- | |
- name: Get Saxon-HE | |
run: | | |
mvn org.apache.maven.plugins:maven-dependency-plugin:2.10:get -DartifactId=Saxon-HE -DgroupId=net.sf.saxon -Dversion=$SAXON_VERSION | |
# Ruby and Bundler | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 # Not needed with a .ruby-version file | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
working-directory: ${{ env.OSCAL_WEBSITE_PATH }} | |
# Hugo | |
- name: Get Hugo | |
run: | | |
wget https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.deb | |
- name: Install Hugo | |
run: | | |
sudo apt-get install ./hugo_extended_${HUGO_VERSION}_Linux-64bit.deb | |
# Build Artifacts | |
# --------------- | |
- name: Generate specification documentation | |
run: | | |
bash "${OSCAL_CICD_PATH}/generate-specification-documentation.sh" | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: specification-docs | |
path: | | |
${{ env.OSCAL_HOME }}/docs/content/documentation/processing/profile-resolution.html | |
retention-days: 5 | |
# job-generate-docs | |
- name: Generate Model Documentation | |
run: | | |
echo "PWD: ${PWD}" | |
echo "OSCAL_HOME: ${OSCAL_HOME}" | |
echo "Github Workspace: ${{ github.workspace }}" | |
echo "Branch: $(git branch --show-current)" | |
BRANCH="${GITHUB_REF}" | |
echo "Branch(1): ${BRANCH}" | |
if [[ "$BRANCH" =~ ^refs/pull/.* ]]; then | |
BRANCH="${GITHUB_HEAD_REF}" | |
echo "Branch(2): ${BRANCH}" | |
elif [[ "$BRANCH" =~ ^refs/heads/.* ]]; then | |
BRANCH="${GITHUB_REF#refs/heads/}" | |
echo "Branch(3): ${BRANCH}" | |
fi | |
echo "Branch(4): ${BRANCH}" | |
bash "../build/ci-cd/generate-model-documentation.sh" -b "${BRANCH}" | |
working-directory: ${{ github.workspace }}/${{ env.OSCAL_HOME }}/docs | |
# - uses: actions/upload-artifact@v2 | |
# with: | |
# name: model-docs | |
# path: | | |
# ${{ env.OSCAL_HOME }}/docs/layouts/partials/generated | |
# retention-days: 5 | |
- name: Run Hugo | |
run: | | |
cd "${OSCAL_WEBSITE_PATH}" | |
hugo -v --debug --minify | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: website | |
path: | | |
${{ env.OSCAL_WEBSITE_PATH }}/public | |
retention-days: 5 | |
# - name: Run HTMLProofer | |
# run: | | |
# cd "${OSCAL_WEBSITE_PATH}" | |
# #--allow-hash-href | |
# bundle exec htmlproofer --check-external-hash public/ --url-swap "https\://pages.nist.gov/OSCAL/:/" --assume-extension --log-level :debug --url-ignore "/\/OSCAL\/docs\/\/reference\/[^/]+\/[^/]+\/(?:json|xml)-(?:outline|reference|index|definitions)/,/#/,/pages.nist.gov\/(?:nist-header-footer|leaveNotice)\/.+/" | |
# - name: Run deploy script | |
# if: ${{ github.repository == env.HOME_REPO && github.ref == format('refs/heads/{0}',env.HOME_BRANCH) }} | |
# run: | | |
# cd "$OSCAL_WEBSITE_PATH" | |
# git config user.name "Deployment Bot" | |
# bash ./deploy.sh --push-only -v -m "Deploying website [ci deploy skip]" |