Skip to content

Publish pages from 'main' instead of 'master'. #22

Publish pages from 'main' instead of 'master'.

Publish pages from 'main' instead of 'master'. #22

Workflow file for this run

name: Deploy specifications to GitHub pages
on:
push:
branches: ["main"]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
# Upload Device Identity Provisioning spec
device-identity-provisioning-spec:
runs-on: ubuntu-latest
container:
image: ghcr.io/trustedcomputinggroup/pandoc:latest
name: Render Device Identity Provisioning HTML
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
- name: Checkout Template dependencies
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
repository: "opencomputeproject/ocp-spec-tools"
# The underlying tex and templates assume this exists under the "extra" folder.
path: "specifications/device-identity-provisioning/extra"
- name: Render Device Identity Provisioning HTML
run: |
# Need to trust directory in the docker container.
chown -R $(id -u):$(id -g) $PWD
# Publish pages for `main`
GIT_REFS=()
GIT_REFS+=("main")
for ref in "${GIT_REFS[@]}"; do
echo "Building git ref $ref"
git reset --hard $ref
pushd specifications/device-identity-provisioning
if [[ "${ref}" == "main" ]]; then
# Label the current spec version.
commit_hash=$(git rev-parse --short HEAD)
sed -i -r "/^---$/,/^---$/s/(version: .*)/\1 (Git commit ${commit_hash})/g" spec.ocp
fi
/usr/bin/build.sh \
--crossref=tcg \
--csl extra/ocp-pandoc-resources/ieee.csl \
--nogitversion \
--template_html extra/ocp-pandoc-resources/html/ocp.html.template \
--html_stylesheet extra/ocp-pandoc-resources/html/style.css \
--html_stylesheet extra/ocp-pandoc-resources/html/github-markdown.css \
--html spec.html spec.ocp
popd
trimmed_ref="HEAD"
mkdir -p "gh-pages/device-identity-provisioning/${trimmed_ref}"
cp specifications/device-identity-provisioning/spec.html "gh-pages/device-identity-provisioning/${trimmed_ref}/index.html"
echo "Added webpage device-identity-provisioning/${trimmed_ref}/index.html"
done
- name: Upload artifacts for device-identity-provisioning spec
uses: actions/upload-artifact@v4
with:
name: device-identity-provisioning
path: gh-pages
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [device-identity-provisioning-spec]
steps:
- name: Download device-identity-provisioning artifacts
uses: actions/download-artifact@v4
with:
name: device-identity-provisioning
path: gh-pages
- name: Upload static files as artifact
uses: actions/upload-pages-artifact@v3
with:
path: "gh-pages"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4