Skip to content

Commit b96aa36

Browse files
chore: fix deploy-doc pipeline
1 parent d92c76a commit b96aa36

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

.github/workflows/deploy_doc.yml

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ on:
55
branch:
66
description: "Deploy doc of which branch?"
77
required: false
8-
type: choice
9-
default: "latest release branch"
10-
options:
11-
- main
12-
- latest release branch
8+
type: string
9+
default: "main"
1310
workflow_call: # called from publish.yml
1411
secrets:
1512
SLACK_WEBHOOK_URL_PYTHON_SDK:
@@ -22,15 +19,23 @@ jobs:
2219
steps:
2320
- name: set checkout branch
2421
run: |
25-
if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ github.event.inputs.branch }}" == "main" ]]; then
26-
echo "REF=main" >> $GITHUB_ENV
22+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
23+
echo "REF=$branch" >> $GITHUB_ENV
2724
else
28-
last_version=$(curl --silent "https://api.github.com/repos/kili-technology/kili-python-sdk/releases/latest" | jq -r .tag_name)
25+
release_payload=$(curl --silent "https://api.github.com/repos/kili-technology/kili-python-sdk/releases/latest")
26+
last_version=$(echo "$release_payload" | jq -r .tag_name)
2927
echo "Last version: $last_version"
3028
31-
IFS=. read -r major minor patch <<< "$last_version"
32-
branch_name="release/$major.$minor"
33-
echo "REF=$branch_name" >> $GITHUB_ENV
29+
release_branch=$(echo "$release_payload" | jq -r .target_commitish)
30+
echo "Release branch: $release_branch"
31+
sanitized_version=${last_version#v}
32+
major_minor=$(echo "$sanitized_version" | awk -F. '{print $1 "." $2}')
33+
34+
if [[ "$release_branch" == "main" ]]; then
35+
echo "REF=main" >> $GITHUB_ENV
36+
else
37+
echo "REF=release/$major_minor" >> $GITHUB_ENV
38+
fi
3439
fi
3540
3641
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)