Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: improve docs release #2420

Merged
merged 16 commits into from
Nov 14, 2023
80 changes: 80 additions & 0 deletions .github/workflows/release-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Release Documentation

on:
workflow_call:
inputs:
tag_name:
description: "Release Tag to use"
type: "string"
required: true

env:
PAGE_DIR: "./tmp/page"

defaults:
run:
shell: bash

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: ${{ env.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 current live version
id: folder
run: |
CURRENT_VERSION=`cat ${{ env.PAGE_DIR }}/docs/content/en/docs/version || echo "unknown"`
echo "Migrating to ${CURRENT_VERSION}"
echo "migrate=docs-$CURRENT_VERSION" >> $GITHUB_OUTPUT

- name: Move current live docs to a versioned folder
env:
FROM: "${{ env.PAGE_DIR }}/docs/content/en/docs"
TO: "${{ env.PAGE_DIR }}/docs/content/en/${{ steps.folder.outputs.migrate }}"
run: |
cp -R $FROM $TO
rm -rf $FROM

- name: Copy old docs into main branch status
run: |
# Copy only the docs folder into the current documentation status from main
cp -R ${{ env.PAGE_DIR }}/docs/content/en/docs-* "./docs/content/en/"

- name: Copy documentation site to page
env:
FOLDER: "${{ env.PAGE_DIR }}/docs/content/en/docs"
run: |
# clean page branch status
rm -rf ${{ env.PAGE_DIR }}/docs
cp -R ./docs ${{ env.PAGE_DIR }}/docs
# mark the new live version with the release tag
echo "${{ inputs.tag_name }}" > "${FOLDER}/version"
sed -i 's/currentversion: main/currentversion: ${{ inputs.tag_name }}/g' "${FOLDER}/_index.md"
# copy netlify conf
cp ./netlify.toml ${{ env.PAGE_DIR }}/netlify.toml


- name: Push content
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
cwd: ${{ env.PAGE_DIR }}
message: "releasing documentation ${{ inputs.tag_name }}"
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ jobs:
if: needs.release-please.outputs.klt-release-created == 'true'
with:
tag_name: ${{ needs.release-please.outputs.klt-tag-name }}
uses: keptn/docs-tooling/.github/workflows/release-docs.yml@v0.1.5
uses: ./.github/workflows/release-docs.yml
secrets: inherit

update-examples:
Expand Down
Loading