Skip to content

Update jekyll-gh-pages.yml #12

Update jekyll-gh-pages.yml

Update jekyll-gh-pages.yml #12

name: Deploy Jekyll with GitHub Pages dependencies preinstalled
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Jekyll structure
run: |
mkdir -p _runbooks
# Create config file
cat > _config.yml << 'EOL'
title: Contrast Security ADR Runbooks
baseurl: "/adr-runbooks"
url: "https://contrast-security-oss.github.io"
markdown: GFM
collections:
runbooks:
output: true
permalink: /runbooks/:name/
defaults:
- scope:
path: ""
type: runbooks
values:
layout: default
EOL
# Process each runbook
for file in runbooks/*.md; do
if [ -f "$file" ] && [ "$(basename "$file")" != "README.md" ]; then
filename=$(basename "$file" | tr '[:upper:]' '[:lower:]' | sed 's/ /-/g' | sed 's/runbook\.md$/md/')
# Start with YAML front matter
{
echo "---"
echo "layout: default"
echo "title: $(basename "$file" | sed 's/RunBook.md//')"
echo "---"
echo
# Add extra newline before each heading
sed 's/^#/\n#/' "$file" | \
# Replace single backslash at end of line with two spaces
sed 's/\\$/ /' | \
# Add newline after code blocks
sed 's/`/`\n/g' | \
# Ensure blank line after bullet points
sed 's/^-/\n-/' | \
# Remove HTML comments
sed 's/<!--.*-->//g' | \
# Remove empty lines but preserve spacing
sed '/^[[:space:]]*$/d'
} > "_runbooks/$filename"
fi
done
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4