Skip to content

Commit 18a64b6

Browse files
Merge pull request #1980 from kili-technology/chore/smooth-release
chore: smooth release
2 parents 3cedea1 + 83d2d48 commit 18a64b6

File tree

4 files changed

+80
-179
lines changed

4 files changed

+80
-179
lines changed

.github/workflows/bump_commit_release_branch.yml

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/workflows/create_draft_release.yml

Lines changed: 0 additions & 112 deletions
This file was deleted.

.github/workflows/pre_release.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Pre-release - Bump version & draft release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
target_branch:
6+
description: >
7+
"This workflow will create a commit to bump version on a branch.
8+
Enter the target branch: main for Saas, or release/XX.Y for a LTS version: "
9+
required: true
10+
type: string
11+
default: "main"
12+
13+
jobs:
14+
pre_release:
15+
runs-on: ubuntu-latest
16+
name: Bump version & draft release
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.event.inputs.target_branch}}
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: 3.12
26+
cache: "pip"
27+
28+
- name: Install dependencies
29+
run: |
30+
python -m pip install --upgrade pip
31+
pip install bump2version
32+
33+
- name: Set git identity
34+
run: |
35+
git config user.name github-actions
36+
git config user.email github-actions@github.com
37+
38+
- name: Add the bump commit
39+
run: |
40+
git fetch --quiet
41+
42+
curl https://raw.githubusercontent.com/kili-technology/kili-python-sdk/main/.github/scripts/utils.sh --output utils.sh
43+
source ./utils.sh # to get the bump_version function
44+
45+
# create bump commit
46+
new_version=$(bump_version commit patch)
47+
echo "New version (bump_version): $new_version"
48+
49+
git push
50+
env:
51+
GH_TOKEN: ${{ github.token }} # needed for gh cli
52+
53+
- name: create draft release
54+
run: |
55+
curl https://raw.githubusercontent.com/kili-technology/kili-python-sdk/main/.github/scripts/utils.sh --output utils.sh
56+
source ./utils.sh # to get the get_sdk_version_from_pyproject_toml function
57+
58+
# Get release version
59+
release_version=$(get_sdk_version_from_pyproject_toml)
60+
echo "Release version: $release_version"
61+
62+
# tag and push the tag
63+
# -a to create an annotated tag
64+
git fetch --quiet
65+
git tag -a $release_version -m "Release $release_version"
66+
git push origin $release_version
67+
68+
# create draft release
69+
link_to_draft=$(gh release create $release_version --draft --title "Release $release_version" --generate-notes --notes-start-tag $latest_release)
70+
echo "Link to draft release: $link_to_draft"
71+
72+
# filter the result to get the link
73+
# will match any string that starts with https:// and contains any number of characters that are not spaces.
74+
link_to_draft=$(echo "$link_to_draft" | grep -o 'https://[^ ]*')
75+
echo "Link to draft release: $link_to_draft"
76+
77+
echo "LINK_TO_DRAFT=$link_to_draft" >> $GITHUB_ENV
78+
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
79+
env:
80+
GH_TOKEN: ${{ github.token }} # needed for gh cli
File renamed without changes.

0 commit comments

Comments
 (0)