Release 2.156.2 #140
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
release: | |
types: [released] | |
jobs: | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
permissions: | |
# needed to publish to PyPI | |
id-token: write | |
# needed to create a PR to merge the release branch and main | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
cache: "pip" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine | |
- name: Build | |
run: | | |
python -m build | |
- name: Test the Build | |
run: | | |
python -m pip install . # to install dependencies | |
python -m pip uninstall -y kili | |
python -m pip install --find-links=dist --no-index kili | |
python -c 'from kili.client import Kili; k=Kili(); print("Everything OK!")' | |
env: | |
KILI_API_ENDPOINT: https://cloud.kili-technology.com/api/label/v2/graphql | |
KILI_API_KEY: ${{ secrets.KILI_USER_API_KEY_PROD }} | |
- name: Make sure we are on a tag | |
run: | | |
if [[ ${{ github.ref }} == refs/tags/* ]]; then | |
echo "We are on a tag" | |
else | |
echo "We are not on a tag" | |
exit 1 | |
fi | |
- name: Publish to test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Slack notification | |
id: slack | |
if: success() | |
uses: slackapi/[email protected] | |
with: | |
payload: | | |
{ | |
"text": "Kili SDK ${{ github.ref_name }} released!\nGitHub: https://github.com/kili-technology/kili-python-sdk/releases\nPyPI: https://pypi.org/project/kili/", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Kili SDK ${{ github.ref_name }} released!\nGitHub: https://github.com/kili-technology/kili-python-sdk/releases\nPyPI: https://pypi.org/project/kili/" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_PYTHON_SDK }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | |
- name: Set git identity | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: create PR to merge release branch and main | |
run: | | |
git fetch --quiet | |
# ${{ github.ref_name }}: The short ref name of the branch or tag that triggered the workflow run. | |
git checkout ${{ github.ref_name }} | |
curl https://raw.githubusercontent.com/kili-technology/kili-python-sdk/main/.github/scripts/utils.sh --output utils.sh | |
source ./utils.sh # to get the bump_version function | |
sdk_version=$(get_sdk_version_from_pyproject_toml) | |
# create a branch to merge the release branch and main | |
git checkout -b merge_release/$sdk_version | |
git push --set-upstream origin merge_release/$sdk_version | |
gh pr create --title "chore: merge release/$sdk_version into main" --body "Merge release/$sdk_version into main" --base main | |
env: | |
GH_TOKEN: ${{ github.token }} # needed for gh cli | |
deploy-documentation: | |
uses: ./.github/workflows/deploy_doc.yml | |
needs: [publish] # Run after the previous job | |
secrets: | |
SLACK_WEBHOOK_URL_PYTHON_SDK: ${{ secrets.SLACK_WEBHOOK_URL_PYTHON_SDK }} |