Skip to content

Deploy SDK doc

Deploy SDK doc #18

Workflow file for this run

name: Deploy SDK doc
on:
workflow_dispatch:
inputs:
branch:
description: "Deploy doc of which branch?"
required: false
type: choice
default: "latest release branch"
options:
- main
- latest release branch
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" && "${{ github.event.inputs.branch }}" == "main" ]]; then
echo "REF=main" >> $GITHUB_ENV
else
last_version=$(curl --silent "https://api.github.com/repos/kili-technology/kili-python-sdk/releases/latest" | jq -r .tag_name)
echo "Last version: $last_version"
IFS=. read -r major minor patch <<< "$last_version"
last_minor_version="$major.$minor.0"
echo "REF=release/$last_minor_version" >> $GITHUB_ENV
fi
- uses: actions/checkout@v3
with:
ref: ${{ env.REF }} # checked out branch
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.8
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 [email protected]
- 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/[email protected]
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