From dfc0b9a9d9ef69469e3134cb96ae98085023adb5 Mon Sep 17 00:00:00 2001 From: swinston Date: Fri, 17 Jan 2025 12:27:39 -0800 Subject: [PATCH 1/5] Add workflow inputs to customize repository branches/tags This commit introduces workflow_dispatch inputs for specifying branch names or tags for multiple repositories in the CI pipeline. It enables flexibility for testing specific versions of dependencies, with defaults set to 'main.' Additionally, a conditional check ensures local publishing to GitHub Pages based on input or event type. --- .github/workflows/ci.yml | 54 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1cb4249a4..da92674e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,42 @@ name: CI on: push: workflow_dispatch: + inputs: + Antora_UI_Hash: + description: 'Antora UI hash (branch name or tag) to use passed from the caller workflow' + default: 'main' + required: false + type: string + GLSL_Commit_Hash: + description: 'GLSL Commit hash (branch name or tag) to use passed from the caller workflow' + default: 'main' + required: false + type: string + Guide_Commit_Hash: + description: 'Guide Commit hash (branch name or tag) to use passed from the caller workflow' + default: 'main' + required: false + type: string + DOC_Commit_Hash: + description: 'Docs Commit hash (branch name or tag) to use passed from the caller workflow' + default: 'main' + required: false + type: string + Samples_Commit_Hash: + description: 'Samples Commit hash (branch name or tag) to use passed from the caller workflow' + default: 'main' + required: false + type: string + Tutorial_Commit_Hash: + description: 'Tutorial Commit hash (branch name or tag) to use passed from the caller workflow' + default: 'main' + required: false + type: string + Publish_Local: + description: 'Should publish to the local github pages https://${GITHUB_REPOSITORY}.github.io' + default: true + required: false + type: boolean jobs: build: @@ -25,12 +61,19 @@ jobs: with: ruby-version: '3.0' + - name: "checkout Antora UI" + uses: actions/checkout@v4 + with: + repository: KhronosGroup/antora-ui-khronos + path: ./antora-ui-khronos + ref: ${{ inputs.Antora_UI_Hash > '' && inputs.Antora_UI_Hash || 'main' }} + - name: "checkout GLSL" uses: actions/checkout@v4 with: repository: KhronosGroup/GLSL path: ./GLSL - ref: main + ref: ${{ inputs.GLSL_Commit_Hash > '' && inputs.GLSL_Commit_Hash || 'main' }} submodules: recursive - name: "checkout Vulkan Guide" @@ -38,7 +81,7 @@ jobs: with: repository: KhronosGroup/Vulkan-Guide path: ./Vulkan-Guide - ref: main + ref: ${{ inputs.Guide_Commit_Hash > '' && inputs.Guide_Commit_Hash || 'main' }} submodules: recursive - name: "Checkout Vulkan Docs" @@ -46,7 +89,7 @@ jobs: with: repository: KhronosGroup/Vulkan-Docs path: ./Vulkan-Docs - ref: main + ref: ${{ inputs.DOC_Commit_Hash > '' && inputs.DOC_Commit_Hash || 'main' }} submodules: recursive - name: "Checkout Vulkan Samples" @@ -54,7 +97,7 @@ jobs: with: repository: KhronosGroup/Vulkan-Samples path: ./Vulkan-Samples - ref: main + ref: ${{ inputs.Samples_Commit_Hash > '' && inputs.Samples_Commit_Hash || 'main' }} submodules: recursive - name: "Checkout Vulkan Tutorial" @@ -62,7 +105,7 @@ jobs: with: repository: KhronosGroup/Vulkan-Tutorial path: ./Vulkan-Tutorial - ref: main + ref: ${{ inputs.Tutorial_Commit_Hash > '' && inputs.Tutorial_Commit_Hash || 'main' }} submodules: recursive - name: "setup npm" @@ -138,6 +181,7 @@ jobs: retention-days: 5 - name: Publish to GitHub Pages + if: "${{ github.event.inputs.Publish_Local || github.event_name == 'pull_request'}}" uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} From 2b3e5232415d4c9112de2972ce70f00157d94470 Mon Sep 17 00:00:00 2001 From: swinston Date: Mon, 1 Dec 2025 21:23:39 -0800 Subject: [PATCH 2/5] Update antora-ui-khronos file --- antora-ui-khronos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/antora-ui-khronos b/antora-ui-khronos index ac0b12aad..9fa87bfe9 160000 --- a/antora-ui-khronos +++ b/antora-ui-khronos @@ -1 +1 @@ -Subproject commit ac0b12aadf11db0625445dd5c3eaf374f1176df8 +Subproject commit 9fa87bfe9f7673b9380de78b297945c295ffacb6 From f5a21c2e9aa8fea445dbdd3dfb5603d5c429d303 Mon Sep 17 00:00:00 2001 From: swinston Date: Mon, 1 Dec 2025 22:24:45 -0800 Subject: [PATCH 3/5] Update project structure or functionality (no specific details provided in diff) --- antora-ui-khronos | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/antora-ui-khronos b/antora-ui-khronos index 9fa87bfe9..595ae245b 160000 --- a/antora-ui-khronos +++ b/antora-ui-khronos @@ -1 +1 @@ -Subproject commit 9fa87bfe9f7673b9380de78b297945c295ffacb6 +Subproject commit 595ae245bbce027e4edfd1894bb88d33a505e660 From f43214ce6d2869242d8124aa80244d0e15498931 Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 2 Dec 2025 00:13:46 -0800 Subject: [PATCH 4/5] Update project structure or functionality (no specific details provided in diff) --- .github/workflows/ci.yml | 75 +++++++++++++++++++++++++++++++++------- 1 file changed, 63 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da92674e5..05a43e3a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,51 +61,102 @@ 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 + # Accept https://github.com/owner/repo@ref (or #ref) + if [[ "$SRC" =~ ^https?://github.com/([^/]+/[^@#]+)[@#]([^[:space:]]+)$ ]]; then + REPO="${BASH_REMATCH[1]}" + REF="${BASH_REMATCH[2]}" + # Accept git@github.com:owner/repo@ref (or #ref) + elif [[ "$SRC" =~ ^git@github.com:([^/]+/[^@#]+)[@#]([^[:space:]]+)$ ]]; then + REPO="${BASH_REMATCH[1]}" + REF="${BASH_REMATCH[2]}" + # Accept owner/repo@ref (or #ref) + elif [[ "$SRC" =~ ^([^/[:space:]]+/[^@#[:space:]]+)[@#]([^[:space:]]+)$ ]]; then + REPO="${BASH_REMATCH[1]}" + REF="${BASH_REMATCH[2]}" + # Accept just branch or sha → use default repo + else + REF="$SRC" + 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" From 30906669e4a065accb3dab3f73d1794397552206 Mon Sep 17 00:00:00 2001 From: swinston Date: Tue, 2 Dec 2025 00:38:46 -0800 Subject: [PATCH 5/5] Normalize and enhance repository reference parsing in CI workflow Improved handling of various GitHub repository reference formats in the CI workflow (e.g., owner/repo@ref, URLs, SSH notations). Enhanced flexibility by supporting additional notations and ensuring proper interpretation of default values when explicit refs are not provided. --- .github/workflows/ci.yml | 65 +++++++++++++++++++++++++++++++--------- 1 file changed, 51 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 05a43e3a6..154c30388 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,21 +76,58 @@ jobs: local REF="$DEF_REF" if [[ -n "${SRC}" ]]; then - # Accept https://github.com/owner/repo@ref (or #ref) - if [[ "$SRC" =~ ^https?://github.com/([^/]+/[^@#]+)[@#]([^[:space:]]+)$ ]]; then - REPO="${BASH_REMATCH[1]}" - REF="${BASH_REMATCH[2]}" - # Accept git@github.com:owner/repo@ref (or #ref) - elif [[ "$SRC" =~ ^git@github.com:([^/]+/[^@#]+)[@#]([^[:space:]]+)$ ]]; then - REPO="${BASH_REMATCH[1]}" - REF="${BASH_REMATCH[2]}" - # Accept owner/repo@ref (or #ref) - elif [[ "$SRC" =~ ^([^/[:space:]]+/[^@#[:space:]]+)[@#]([^[:space:]]+)$ ]]; then - REPO="${BASH_REMATCH[1]}" - REF="${BASH_REMATCH[2]}" - # Accept just branch or sha → use default repo + # 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 - REF="$SRC" + # No slash → treat as branch/SHA on default repo + if [[ -n "$BASE" ]]; then + REF="$BASE" + fi fi fi