Skip to content

Deploy SDK doc

Deploy SDK doc #26

Workflow file for this run

name: Deploy SDK doc
on:
workflow_dispatch:
inputs:
branch:
description: "Deploy doc of which branch?"
required: false
type: string
default: "main"
workflow_call: # called from publish.yml
secrets:
SLACK_WEBHOOK_URL_PYTHON_SDK:
required: true
jobs:
deploy-documentation:
name: Deploy technical documentation
runs-on: ubuntu-latest
steps:
- name: set checkout branch
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "REF=$branch" >> $GITHUB_ENV
else
release_payload=$(curl --silent "https://api.github.com/repos/kili-technology/kili-python-sdk/releases/latest")
last_version=$(echo "$release_payload" | jq -r .tag_name)
echo "Last version: $last_version"
release_branch=$(echo "$release_payload" | jq -r .target_commitish)
echo "Release branch: $release_branch"
sanitized_version=${last_version#v}
major_minor=$(echo "$sanitized_version" | awk -F. '{print $1 "." $2}')
if [[ "$release_branch" == "main" ]]; then
echo "REF=main" >> $GITHUB_ENV
else
echo "REF=release/$major_minor" >> $GITHUB_ENV
fi
fi
- uses: actions/checkout@v4
with:
ref: ${{ env.REF }} # checked out branch
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: setup git
run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Deploy doc
run: |
export version=$(python -c 'from kili import __version__; print(".".join(__version__.split(".")[:2]))') # removes patch suffix
git fetch origin gh-pages --depth=1
mike deploy --push --update-aliases $version latest
- name: Slack notification
id: slack
if: success()
uses: slackapi/slack-github-action@v1.25.0
with:
payload: |
{
"text": "Kili technical documentation released: https://python-sdk-docs.kili-technology.com/. \nA Hard refresh may be useful to see the latest version",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Kili technical documentation released: https://python-sdk-docs.kili-technology.com/. \nA Hard refresh may be useful to see the latest version"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_PYTHON_SDK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK