diff --git a/.github/workflows/release-docs.yml b/.github/workflows/release-docs.yml new file mode 100644 index 0000000000..1a8956bbef --- /dev/null +++ b/.github/workflows/release-docs.yml @@ -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/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 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 }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d41afb18b0..11980611ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: