Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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