Skip to content

Commit

Permalink
Improving ubild
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Schrottner <[email protected]>
  • Loading branch information
aepfli committed Feb 21, 2023
1 parent 1a48b47 commit d14f48f
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/release-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release Documentation

on:
release:
types: [published]


env:
PAGE_DIR: ./tmp/page
DOCS_DIR: ./tmp/page/docs

jobs:
release-docs:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout - page branch
uses: actions/checkout@v3
with:
ref: "page"
path: "$PAGE_DIR"

- name: Get Latest Release Information
uses: octokit/[email protected]
id: latest_release
with:
route: GET /repos/:owner/:repository/releases/latest
repository: lifecycle-toolkit
owner: keptn
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Detect needed Folder Operations
id: folder
run: |
CURRENT_VERSION=`cat $PAGE_DIR/content/en/docs/version`
echo $CURRENT_VERSION
if [[ "${{ fromJson(steps.latest_release.outputs.data).tag_name }}" == "${{ github.event.release.tag_name }}" ]]; then
if [[ "${{ fromJson(steps.latest_release.outputs.data).tag_name }}" != "$CURRENT_VERSION" ]]; then
echo "migrate=docs-$CURRENT_VERSION" >> $GITHUB_OUTPUT
fi
echo "name=docs" >> $GITHUB_OUTPUT
echo "latest=true" >> $GITHUB_OUTPUT
else
echo "name=docs-${{github.event.release.tag_name}}" >> $GITHUB_OUTPUT
fi
- name: Move old latest release documentation folder
run: cp -R "$DOCS_DIR/content/en/docs/." "$DOCS_DIR/content/en/${{ steps.folder.outputs.migrate}}"
if: ${{steps.folder.outputs.migrate }}
- name: Copy configuration
run: |
cp -R ./docs/. "$DOCS_DIR"
if: ${{steps.folder.outputs.latest }}
- name: Copy documentation folder
run: |
cp -R ./docs/content/en/docs/. "$DOCS_DIR/content/en/${{ steps.folder.outputs.name}}"
echo "${{ fromJson(steps.latest_release.outputs.data).tag_name }}" > "$DOCS_DIR/content/en/${{ steps.folder.outputs.name}}/version"
- name: Push content
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
cwd: "$PAGE_DIR"
message: "releasing documentation ${{ fromJson(steps.latest_release.outputs.data).tag_name }}"
26 changes: 26 additions & 0 deletions docs/config/_default/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
_merge: deep
module:
hugoVersion:
extended: true
imports:
- path: github.com/keptn-sandbox/lifecycle-toolkit-docs
ignoreConfig: false
mounts:
- source: static
target: static
- source: layouts
target: layouts
- source: data
target: data
- source: assets
target: assets
- source: archetypes
target: archetypes
- source: content/en/_index.md
target: content/en/_index.md
proxy: direct
languages:
en:
title: Docsy
contentDir: "content/en"

7 changes: 7 additions & 0 deletions docs/config/_default/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

version: latest
versions:
- url: /docs/
version: development
- url: https://lifecycle.keptn.sh
version: production
18 changes: 18 additions & 0 deletions docs/layouts/partials/navbar-version-selector.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
{{ .Site.Params.version_menu }}
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
{{ range first 5 (sort .Site.Pages ".File.ContentBaseName" "desc") -}}
{{ if (findRE "docs" .File.ContentBaseName) -}}
{{ $version := replaceRE "docs-" "" .File.ContentBaseName -}}
<a class="dropdown-item" href="{{ .RelPermalink }}">folder-{{ $version }}</a>
{{ end -}}
{{ end -}}
{{ $path := "" }}
{{ if .Site.Params.version_menu_pagelinks }}
{{ $path = .Page.RelPermalink }}
{{ end }}
{{ range .Site.Params.versions }}
<a class="dropdown-item" href="{{ .url }}{{ $path }}">{{ .version }}</a>
{{ end }}
</div>

0 comments on commit d14f48f

Please sign in to comment.