From 6168786b9e5b9ce3812660343fd1228ae269e4b0 Mon Sep 17 00:00:00 2001 From: Anastasia Alexadrova Date: Wed, 22 Jul 2026 14:17:32 +0300 Subject: [PATCH 1/2] Implemented version switcher for docs the Operators way --- .github/workflows/main.yaml | 63 ++++++++++++++++++++++++ .github/workflows/{main.yml => vale.yml} | 0 .nojekyll | 0 _resourcepdf/overrides/main.html | 4 +- mkdocs-base.yml | 4 ++ 5 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/main.yaml rename .github/workflows/{main.yml => vale.yml} (100%) create mode 100644 .nojekyll diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 00000000..01792e72 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,63 @@ +name: Build Percona Backup for MongoDB docs +on: + push: + branches: + - main + +jobs: + build: + name: Deploy docs + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + #Pull the latest changes + - name: Checkout code + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 # fetch all commits/branches + #Prepare the env + - name: Set up Python + uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + python-version: '3.x' + + #Configure git + - name: Configure git + env: + ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }} + run: | + git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com" + git config user.name "GitHub Action" + git config user.email "github-action@users.noreply.github.com" + git config user.password "${ROBOT_TOKEN}" + echo "GIT_USER=percona-platform-robot:${ROBOT_TOKEN}" >> $GITHUB_ENV + + + #Extract release from YAML + - name: Extract release from variables + run: | + RELEASE=$(grep '^release:' variables.yml | awk '{print $2}' | tr -d "'") + echo "RELEASE=$RELEASE" >> $GITHUB_ENV +# PRUNED_VERSION=$(grep '^pruned_version:' variables.yml | awk '{print $2}' | tr -d "'") +# echo "PRUNED_VERSION"=$"PRUNED_VERSION" >> $GITHUB_ENV + + + #Set up MkDocs + - name: Install MkDocs + run: | + python -m pip install --upgrade pip + pip install wheel + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + + # Deploy docs + - name: Deploy docs + env: + MKDOCS_GIT_COMMITTERS_APIKEY: ${{ secrets.ROBOT_TOKEN }} + run: | + mike deploy $RELEASE -u latest -b publish -p + mike set-default latest -b publish -p +# mike delete $PRUNED_VERSION -b publish -p + \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/vale.yml similarity index 100% rename from .github/workflows/main.yml rename to .github/workflows/vale.yml diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 00000000..e69de29b diff --git a/_resourcepdf/overrides/main.html b/_resourcepdf/overrides/main.html index 388f22f5..4ef56b15 100644 --- a/_resourcepdf/overrides/main.html +++ b/_resourcepdf/overrides/main.html @@ -44,8 +44,8 @@ {% endif %} - - + + {% endblock %} {% block site_nav %} diff --git a/mkdocs-base.yml b/mkdocs-base.yml index a4357013..f6ae4079 100644 --- a/mkdocs-base.yml +++ b/mkdocs-base.yml @@ -81,6 +81,10 @@ extra_javascript: - js/consent.js - js/rating.js +extra: + version: + provider: mike + markdown_extensions: abbr: {} attr_list: {} From 1b610dbcb422fcbfb3d452b8e51fcf99dc4c3c66 Mon Sep 17 00:00:00 2001 From: Anastasia Alexadrova Date: Wed, 5 Aug 2026 16:11:53 +0200 Subject: [PATCH 2/2] Updated steps to add more security --- .github/workflows/main.yaml | 29 ++++++++--------- .github/workflows/vale.yml | 62 ++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 45 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 01792e72..f471750a 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -22,18 +22,6 @@ jobs: uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 with: python-version: '3.x' - - #Configure git - - name: Configure git - env: - ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }} - run: | - git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com" - git config user.name "GitHub Action" - git config user.email "github-action@users.noreply.github.com" - git config user.password "${ROBOT_TOKEN}" - echo "GIT_USER=percona-platform-robot:${ROBOT_TOKEN}" >> $GITHUB_ENV - #Extract release from YAML - name: Extract release from variables @@ -51,7 +39,16 @@ jobs: pip install wheel if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - + # Configure git auth right before it's needed, scoped to this checkout only, + # so the credential isn't live on disk for the earlier setup steps. + - name: Configure git + env: + ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }} + run: | + git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic $(printf '%s' "x-access-token:${ROBOT_TOKEN}" | base64 -w0)" + git config user.name "GitHub Action" + git config user.email "github-action@users.noreply.github.com" + # Deploy docs - name: Deploy docs env: @@ -60,4 +57,8 @@ jobs: mike deploy $RELEASE -u latest -b publish -p mike set-default latest -b publish -p # mike delete $PRUNED_VERSION -b publish -p - \ No newline at end of file + + # Drop the credential as soon as it's no longer needed + - name: Clear git credentials + if: always() + run: git config --local --unset-all http.https://github.com/.extraheader || true \ No newline at end of file diff --git a/.github/workflows/vale.yml b/.github/workflows/vale.yml index 3d8d6996..9e641f0b 100644 --- a/.github/workflows/vale.yml +++ b/.github/workflows/vale.yml @@ -1,38 +1,38 @@ name: Check docs with Vale -on: +on: pull_request: branches: - main -jobs: -vale: - name: runner / vale - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 -#Configure git - - name: Configure git - env: - ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }} - run: | - git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com" - git config user.name "GitHub Action" - git config user.email "github-action@users.noreply.github.com" - git config user.password "${ROBOT_TOKEN}" - echo "GIT_USER=percona-platform-robot:${ROBOT_TOKEN}" >> $GITHUB_ENV +jobs: + vale: + name: runner / vale + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + fetch-depth: 0 + # Configure git + - name: Configure git + env: + ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }} + run: | + git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com" + git config user.name "GitHub Action" + git config user.email "github-action@users.noreply.github.com" + git config user.password "${ROBOT_TOKEN}" + echo "GIT_USER=percona-platform-robot:${ROBOT_TOKEN}" >> $GITHUB_ENV -#Run check - - name: reviewdog - uses: errata-ai/vale-action@reviewdog - with: - vale_flags: "--glob=*.md" -# fail_on_error: true - reporter: github-check - env: - # Required, set by GitHub actions automatically: - # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + # Run check + - name: reviewdog + uses: errata-ai/vale-action@reviewdog + with: + vale_flags: "--glob=*.md" + # fail_on_error: true + reporter: github-check + env: + # Required, set by GitHub actions automatically: + # https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}