Skip to content

Commit

Permalink
docs: add Netlify configuration and advanced build (#892)
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Signed-off-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
Co-authored-by: Moritz Wiesinger <moritz.wiesinger@dynatrace.com>
  • Loading branch information
aepfli and mowies committed Feb 28, 2023
1 parent d90355d commit 81cd1f2
Show file tree
Hide file tree
Showing 21 changed files with 1,027 additions and 261 deletions.
110 changes: 0 additions & 110 deletions .github/actions/update-documentation/action.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .github/actions/update-documentation/scripts/requirements.txt

This file was deleted.

57 changes: 0 additions & 57 deletions .github/actions/update-documentation/scripts/update_docs.py

This file was deleted.

19 changes: 2 additions & 17 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
paths-ignore:
- "docs/**"
- "**.md"
- "netlify.toml"

env:
GO_VERSION: "~1.19"
# renovate: datasource=github-releases depName=kubernetes-sigs/controller-tools
Expand Down Expand Up @@ -290,23 +292,6 @@ jobs:
name: ${{ matrix.config.name }}-manifest
path: ${{ matrix.config.folder }}/config/rendered/release.yaml

update-docs:
name: Update Documentation
needs:
- prepare_ci_run
if: github.event_name == 'push' && needs.prepare_ci_run.outputs.NON_FORKED_AND_NON_ROBOT_RUN == 'true'
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Update Documentation
uses: ./.github/actions/update-documentation
with:
version: "dev"
klt-repo: ${{ github.workspace }}
token: ${{ secrets.KEPTN_SANDBOX_BOT_TOKEN }}

helm_charts_build:
name: Publish helm chart changes to charts repo
if: github.event_name == 'push' && needs.prepare_ci_run.outputs.NON_FORKED_AND_NON_ROBOT_RUN == 'true'
Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/release-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release Documentation

on:
workflow_call:
inputs:
tag_name:
description: "Tag for the functions runner image"
type: "string"
required: true
page_dir:
description: "Root directory of the website"
type: "string"
required: true
default: "./tmp/page"
docs_dir:
description: "Root directory of the website"
type: "string"
required: true
default: "/docs"
dry_run:
description: "Flag for testing"
type: "boolean"
default: false
required: false

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: ${{ inputs.page_dir }}
token: ${{ secrets.KEPTN_BOT_TOKEN }}

- name: Get Latest Release Information
uses: octokit/request-action@v2.x
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 ${{ inputs.page_dir }}${{ inputs.docs_dir }}/content/en/docs/version || "unknown"`
echo $CURRENT_VERSION
if [[ "${{ fromJson(steps.latest_release.outputs.data).tag_name }}" == "${{ inputs.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-${{ inputs.tag_name }}" >> $GITHUB_OUTPUT
fi
- name: Move old latest release documentation folder
if: ${{steps.folder.outputs.migrate }}
run: cp -R "${{ inputs.page_dir }}${{ inputs.docs_dir }}/content/en/docs/." "${{ inputs.page_dir }}${{ inputs.docs_dir }}/content/en/${{ steps.folder.outputs.migrate }}"

- name: Copy configuration
if: ${{steps.folder.outputs.latest }}
run: |
cp -R ./docs/. "${{ inputs.page_dir }}${{ inputs.docs_dir }}"
- name: Copy documentation folder
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"
- name: Push content
if: ${{ inputs.dry_run != true }}
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
cwd: ${{ inputs.page_dir }}
message: "releasing documentation ${{ inputs.tag_name }}"
15 changes: 3 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,6 @@ jobs:
needs:
- release-please
if: needs.release-please.outputs.releases_created == 'true'
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Update Documentation
uses: ./.github/actions/update-documentation
with:
version: ${{ needs.release-please.outputs.tag_name }}
klt-repo: ${{ github.workspace }}
token: ${{ secrets.KEPTN_SANDBOX_BOT_TOKEN }}
update-main: true
with:
tag_name: ${{ needs.release-please.outputs.tag_name }}
uses: ./.github/workflows/release-docs.yml
2 changes: 1 addition & 1 deletion docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.hugo_build.lock
resources/_gen
public
go.sum
node_modules
15 changes: 8 additions & 7 deletions docs/config.yaml → docs/config/_default/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
_merge: deep
title: Keptn

module:
hugoVersion:
extended: true
imports:
- path: github.com/keptn-sandbox/lifecycle-toolkit-docs
ignoreConfig: false
Expand All @@ -17,10 +21,7 @@ module:
- source: content/en/_index.md
target: content/en/_index.md
proxy: direct

params:
versions:
- url: /docs/
version: development
- url: https://lifecycle.keptn.sh
version: production
languages:
en:
title: Keptn
contentDir: "content/en"
10 changes: 10 additions & 0 deletions docs/config/_default/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
github_branch: main
github_project_repo: https://github.com/keptn/lifecycle-toolkit
github_repo: https://github.com/keptn/lifecycle-toolkit
github_subdir: docs

versions:
- url: /docs/
version: development
- url: https://lifecycle.keptn.sh
version: production
4 changes: 4 additions & 0 deletions docs/config/production/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
versions:
- url: https://dev.lifecycle-test.keptn.sh
version: development
github_branch: pages

0 comments on commit 81cd1f2

Please sign in to comment.