From 85563f8c6bc178fd1cadbfe14ddd9e116f5dbd94 Mon Sep 17 00:00:00 2001 From: Markus Schmidt Date: Tue, 31 Oct 2023 13:24:20 +0100 Subject: [PATCH] enable multiple versions of doc --- .github/workflows/gh-pages-cleanup.yml | 21 +++++++++++++++++++++ .github/workflows/gh-pages.yml | 15 +++++++++++---- 2 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/gh-pages-cleanup.yml diff --git a/.github/workflows/gh-pages-cleanup.yml b/.github/workflows/gh-pages-cleanup.yml new file mode 100644 index 00000000000..0b9b4905572 --- /dev/null +++ b/.github/workflows/gh-pages-cleanup.yml @@ -0,0 +1,21 @@ +name: Delete obsolete Documentation +on: delete + +permissions: + contents: write + +jobs: + delete: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + with: + python-version: 3.x + - run: pip install mike + - run: git fetch origin gh-pages --depth=1 + - name: Configure git user + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + - run: mike delete $(echo ${{ github.event.ref }} | sed -e "s#refs/heads/##g") --push \ No newline at end of file diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index dd1bd1c3ea6..ee4dd374cc2 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -1,14 +1,14 @@ name: Documentation on: push: - branches: - - develop - # only trigger workflow if one of these paths are affected as well paths: - 'mkdocs.yml' - 'sootup.examples/**' - 'docs/**' +permissions: + contents: write + jobs: deploy: runs-on: ubuntu-latest @@ -17,6 +17,7 @@ jobs: - uses: actions/setup-python@v2 with: python-version: 3.x + - run: pip install mike - run: pip install mkdocs-material - run: pip install mkdocs-tooltips - run: pip install git+https://github.com/RedisLabs/mkdocs-include.git @@ -24,5 +25,11 @@ jobs: # grab latest release url of the JimpleLSP jar and download it - run: curl -s -L -o ./jimplelsp.jar $(curl -s https://api.github.com/repos/swissiety/jimpleLsp/releases/latest | grep 'browser_download_url".*jar"' | cut -d ':' -f 2,3 | tr -d \") # replace version in .md files + - run: sed -i 's\{{ git_latest_release }}\'$(git tag --sort=committerdate | grep -E '[0-9]' | tail -1 | cut -b 2-7)'\g' *.md - - run: mkdocs gh-deploy --force + - run: git fetch origin gh-pages --depth=1 + - name: Configure git user + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + - run: mike deploy ${{ github.ref_name }} --push \ No newline at end of file