Skip to content

Commit 6573736

Browse files
committed
ci(publish): improve rc steps
1 parent 4668d91 commit 6573736

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

.github/workflows/publish.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,17 @@ jobs:
2929
path: .venv
3030
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }}
3131

32-
- name: Get rc version
32+
- name: Get and set rc version
3333
if: github.ref == 'refs/heads/release-please--branches--main'
34-
id: get-rc-version
35-
continue-on-error: true
3634
run: |
37-
rc_version=$(curl -s https://pypi.org/pypi/instill-sdk/json | jq '.releases | keys' | sort -V | tr -d '[]"", ' | sed '/^$/d' | tail -1 | grep -Eo ''$(poetry version -s)'rc[0-9]+$' | grep -Eo '[0-9]+$')
38-
echo "rc_version=$rc_version" >> $GITHUB_OUTPUT
39-
40-
- name: Tag rc version
41-
if: github.ref == 'refs/heads/release-please--branches--main'
42-
run: |
43-
if [ ${{ steps.get-rc-version.outcome }} == 'failure' ]; then
44-
rc_version=0
45-
else
46-
rc_version=${{ steps.get-rc-version.outputs.rc_version }}
35+
latest_version=$(curl -s https://pypi.org/pypi/instill-sdk/json | jq '.releases | keys' | sort -V | tr -d '[]"", ' | sed '/^$/d' | tail -1)
36+
if echo "$latest_version" | grep -q 'rc[0-9]*$'; then
37+
rc_version=$(echo "$latest_version" | sed 's/.*rc\([0-9]*\)/\1/')
4738
rc_version=$((rc_version+1))
39+
else
40+
rc_version=0
4841
fi
49-
poetry version "$(poetry version -s)rc$(echo $rc_version)"
42+
poetry version "$(poetry version -s)rc$rc_version"
5043
5144
- name: Clean and Build
5245
run: |

0 commit comments

Comments
 (0)