Skip to content

Update postgres Docker tag to v17.1 #743

Update postgres Docker tag to v17.1

Update postgres Docker tag to v17.1 #743

Workflow file for this run

name: Publish docs
on:
push:
branches:
- "[0-9]+.[0-9]+.x"
release:
types:
- published
jobs:
build:
name: Deploy docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install dependencies
run: pip install -r docs/requirements.txt
- name: Set up git author
uses: oleksiyrudenko/gha-git-credentials@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Find latest release
id: latest_release
uses: pozetroninc/[email protected]
with:
repository: ${{ github.repository }}
excludes: draft,prerelease
- name: Normalize current versions
id: current
uses: actions/github-script@v7
with:
script: return context.ref.match(/([0-9]+\.[0-9]+)\.(x|[0-9]+)/i)[1];
result-encoding: string
- name: Normalize latest versions
id: latest
uses: actions/github-script@v7
with:
script: return "${{steps.latest_release.outputs.release}}".match(/([0-9]+\.[0-9]+)\.[0-9]+/i)[1];
result-encoding: string
- name: Setup deploy key
env:
REPOSITORY_ACCESS_KEY: ${{ secrets.REPOSITORY_ACCESS_KEY }}
run: |
# Setup SSH deploy key
mkdir -p ~/.ssh
echo "${REPOSITORY_ACCESS_KEY}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H github.com > ~/.ssh/known_hosts
- run: git remote add doc [email protected]:patchlevel/event-sourcing-docs.git
- run: git fetch doc gh-pages --verbose
- run: |
current_major=$(echo "${{ steps.current.outputs.result }}" | cut -d '.' -f 1)
current_minor=$(echo "${{ steps.current.outputs.result }}" | cut -d '.' -f 2)
latest_major=$(echo "${{ steps.latest.outputs.result }}" | cut -d '.' -f 1)
latest_minor=$(echo "${{ steps.latest.outputs.result }}" | cut -d '.' -f 2)
if [ "${{ steps.current.outputs.result }}" = "${{ steps.latest.outputs.result }}" ]
then
# Here we deploy a new latest version
mike deploy latest --config-file docs/mkdocs.yml --title="${{ steps.current.outputs.result }} (latest)" --push --remote doc
elif [ "$current_major" -lt "$latest_major" ] || \
{ [ "$current_major" -eq "$latest_major" ] && [ "$current_minor" -lt "$latest_minor" ]; }
then
# Here we deploy a version that's not the latest one and smaller as the latest version
mike deploy ${{ steps.current.outputs.result }} --config-file docs/mkdocs.yml --push --remote doc
fi
- run: |
# Check if the "latest" alias exists
HAS_LATEST=$(mike list --config-file docs/mkdocs.yml --rebase --remote doc | grep latest) || true
# If so then it is set as the default version (to enable the index redirect)
if [ "${HAS_LATEST}" != "" ]
then
echo "Set latest as default"
mike set-default latest --config-file docs/mkdocs.yml --remote doc
fi