Skip to content
Open
112 changes: 100 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,51 +61,139 @@ jobs:
with:
ruby-version: '3.0'

- name: Resolve repository/ref overrides
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes in ci.yml seem unrelated to changing the lunr version (and perhaps inherited from #147).

id: resolve
shell: bash
run: |
set -euo pipefail

parse() {
local SRC="$1"; shift
local DEF_REPO="$1"; shift
local DEF_REF="$1"; shift
local PREFIX="$1"; shift
local REPO="$DEF_REPO"
local REF="$DEF_REF"

if [[ -n "${SRC}" ]]; then
# Normalize common GitHub notations into OWNER/REPO and REF
# Supported forms:
# - owner/repo@ref
# - owner/repo#ref
# - owner/repo/branch@ref (branch path ignored, ref used)
# - owner/repo/branch (no @/# → use branch as ref)
# - https://github.com/owner/repo@ref
# - https://github.com/owner/repo/branch@ref
# - git@github.com:owner/repo@ref
# - plain "branchOrSha" (no /) → use default repo with given ref

local VAL="$SRC"
# Strip URL/SSH prefixes if present
if [[ "$VAL" =~ ^https?://github.com/ ]]; then
VAL="${VAL#*github.com/}"
elif [[ "$VAL" =~ ^git@github.com: ]]; then
VAL="${VAL#git@github.com:}"
fi

# Split at @ or # if present
local BASE="$VAL"
if [[ "$VAL" == *"@"* ]]; then
BASE="${VAL%%@*}"
REF="${VAL#*@}"
elif [[ "$VAL" == *"#"* ]]; then
BASE="${VAL%%#*}"
REF="${VAL#*#}"
fi

# If BASE contains owner/repo[/...]
if [[ "$BASE" == */* ]]; then
# Extract first two segments as owner/repo
local OWNER="${BASE%%/*}"
local REST="${BASE#*/}"
local REPO_NAME="${REST%%/*}"
# remove potential .git suffix from repo name
REPO_NAME="${REPO_NAME%.git}"
if [[ -n "$OWNER" && -n "$REPO_NAME" ]]; then
REPO="$OWNER/$REPO_NAME"
# If no explicit @/# ref was provided and there is a third segment, use it as ref
if [[ "$VAL" != *"@"* && "$VAL" != *"#"* ]]; then
local REMREST="${REST#*/}"
if [[ "$REMREST" != "$REST" && -n "$REMREST" ]]; then
REF="${REMREST%%/*}"
fi
fi
fi
else
# No slash → treat as branch/SHA on default repo
if [[ -n "$BASE" ]]; then
REF="$BASE"
fi
fi
fi

echo "${PREFIX}_REPO=${REPO}" >> "$GITHUB_OUTPUT"
echo "${PREFIX}_REF=${REF}" >> "$GITHUB_OUTPUT"
echo "Resolved ${PREFIX}: ${REPO}@${REF}"
}

# Antora UI
parse "${{ inputs.Antora_UI_Hash }}" "KhronosGroup/antora-ui-khronos" "main" "UI"
# GLSL
parse "${{ inputs.GLSL_Commit_Hash }}" "KhronosGroup/GLSL" "main" "GLSL"
# Vulkan Guide
parse "${{ inputs.Guide_Commit_Hash }}" "KhronosGroup/Vulkan-Guide" "main" "GUIDE"
# Vulkan Docs
parse "${{ inputs.DOC_Commit_Hash }}" "KhronosGroup/Vulkan-Docs" "main" "DOCS"
# Vulkan Samples
parse "${{ inputs.Samples_Commit_Hash }}" "KhronosGroup/Vulkan-Samples" "main" "SAMPLES"
# Vulkan Tutorial
parse "${{ inputs.Tutorial_Commit_Hash }}" "KhronosGroup/Vulkan-Tutorial" "main" "TUTORIAL"

- name: "checkout Antora UI"
uses: actions/checkout@v4
with:
repository: KhronosGroup/antora-ui-khronos
repository: ${{ steps.resolve.outputs.UI_REPO }}
path: ./antora-ui-khronos
ref: ${{ inputs.Antora_UI_Hash > '' && inputs.Antora_UI_Hash || 'main' }}
ref: ${{ steps.resolve.outputs.UI_REF }}

- name: "checkout GLSL"
uses: actions/checkout@v4
with:
repository: KhronosGroup/GLSL
repository: ${{ steps.resolve.outputs.GLSL_REPO }}
path: ./GLSL
ref: ${{ inputs.GLSL_Commit_Hash > '' && inputs.GLSL_Commit_Hash || 'main' }}
ref: ${{ steps.resolve.outputs.GLSL_REF }}
submodules: recursive

- name: "checkout Vulkan Guide"
uses: actions/checkout@v4
with:
repository: KhronosGroup/Vulkan-Guide
repository: ${{ steps.resolve.outputs.GUIDE_REPO }}
path: ./Vulkan-Guide
ref: ${{ inputs.Guide_Commit_Hash > '' && inputs.Guide_Commit_Hash || 'main' }}
ref: ${{ steps.resolve.outputs.GUIDE_REF }}
submodules: recursive

- name: "Checkout Vulkan Docs"
uses: actions/checkout@v4
with:
repository: KhronosGroup/Vulkan-Docs
repository: ${{ steps.resolve.outputs.DOCS_REPO }}
path: ./Vulkan-Docs
ref: ${{ inputs.DOC_Commit_Hash > '' && inputs.DOC_Commit_Hash || 'main' }}
ref: ${{ steps.resolve.outputs.DOCS_REF }}
submodules: recursive

- name: "Checkout Vulkan Samples"
uses: actions/checkout@v4
with:
repository: KhronosGroup/Vulkan-Samples
repository: ${{ steps.resolve.outputs.SAMPLES_REPO }}
path: ./Vulkan-Samples
ref: ${{ inputs.Samples_Commit_Hash > '' && inputs.Samples_Commit_Hash || 'main' }}
ref: ${{ steps.resolve.outputs.SAMPLES_REF }}
submodules: recursive

- name: "Checkout Vulkan Tutorial"
uses: actions/checkout@v4
with:
repository: KhronosGroup/Vulkan-Tutorial
repository: ${{ steps.resolve.outputs.TUTORIAL_REPO }}
path: ./Vulkan-Tutorial
ref: ${{ inputs.Tutorial_Commit_Hash > '' && inputs.Tutorial_Commit_Hash || 'main' }}
ref: ${{ steps.resolve.outputs.TUTORIAL_REF }}
submodules: recursive

- name: "setup npm"
Expand Down
2 changes: 1 addition & 1 deletion docs-site/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"devDependencies": {
"@antora/cli": "3.1.4",
"@antora/lunr-extension": "khronosgroup/antora-lunr-extension#d8194f2fa724faae334508c537f7911e9e48665a",
"@antora/lunr-extension": "gpx1000/antora-lunr-extension#e92ae89dd94ba663a1ad519192430feddbb001c5",
"@antora/site-generator": "3.1.10",
"@djencks/asciidoctor-mathjax": "0.0.9",
"escape-string-regexp": "^5.0.0",
Expand Down