From 9b277e0f440d037e2bf3c4cc05432fdc4d467302 Mon Sep 17 00:00:00 2001 From: RealAnna <89971034+RealAnna@users.noreply.github.com> Date: Mon, 19 Jun 2023 13:13:32 +0200 Subject: [PATCH] feat: add currentversion variable in docs index (#4) Signed-off-by: realanna --- .github/workflows/release-docs.yml | 3 ++- .htmltest.yml | 1 + layouts/shortcodes/embed.html | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 layouts/shortcodes/embed.html diff --git a/.github/workflows/release-docs.yml b/.github/workflows/release-docs.yml index a0c5516..4e570da 100644 --- a/.github/workflows/release-docs.yml +++ b/.github/workflows/release-docs.yml @@ -75,7 +75,8 @@ jobs: run: | cp -R ./docs/content/en/docs/. "${{ inputs.page_dir }}${{ inputs.docs_dir }}/content/en/${{ steps.folder.outputs.name}}" echo "${{ inputs.tag_name }}" > "${{ inputs.page_dir }}${{ inputs.docs_dir }}/content/en/${{ steps.folder.outputs.name}}/version" - + sed -i 's/cascade:/cascade:\n currentversion:${{ inputs.tag_name }}/g' "${{ inputs.page_dir }}${{ inputs.docs_dir }}/content/en/${{ steps.folder.outputs.name}}/_index.md" + - name: Push content if: ${{ inputs.dry_run != true }} uses: EndBug/add-and-commit@v9 diff --git a/.htmltest.yml b/.htmltest.yml index 2381ae7..868163e 100644 --- a/.htmltest.yml +++ b/.htmltest.yml @@ -5,4 +5,5 @@ IgnoreDirs: IgnoreURLs: - "linkedin.com" - "localhost" + - "twitter.com" StripQueryString: false diff --git a/layouts/shortcodes/embed.html b/layouts/shortcodes/embed.html new file mode 100644 index 0000000..fc87a3f --- /dev/null +++ b/layouts/shortcodes/embed.html @@ -0,0 +1,11 @@ + +{{ $u := printf "%s%s/%s" "https://raw.githubusercontent.com/keptn/lifecycle-toolkit/" (.Page.Params.currentversion) (.Get "path") }} + {{ with resources.GetRemote $u }} + {{ with .Err }} + {{ errorf "%s" . }} + {{ else }} + {{- highlight (.Content | htmlUnescape | safeHTML ) "yaml" -}} + {{ end }} +{{ else }} + {{ errorf "Unable to get remote resource." }} +{{ end }}