Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 44 additions & 1 deletion .github/workflows/sdk_publish_mistralai_sdk.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Publish MISTRALAI-SDK
permissions:
contents: read
contents: write
id-token: write
"on":
workflow_dispatch:
Expand Down Expand Up @@ -48,3 +48,46 @@ jobs:
print-hash: true
verbose: true
skip-existing: true

- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail

VERSION=$(awk -F\" '/^version[[:space:]]*=/ {print $2; exit}' pyproject.toml)
if [ -z "$VERSION" ]; then
echo "Could not read version from pyproject.toml" >&2
exit 1
fi
echo "Detected version: $VERSION"

TAG="v${VERSION}"
INVOKE_TIME=$(date -u '+%Y-%m-%d %H:%M:%S')

BODY_FILE=$(mktemp)
{
printf '# Generated by Speakeasy CLI\n\n'
if [ -f RELEASES.md ]; then
awk '/^## /{buf=""} {buf=buf $0 "\n"} END{printf "%s", buf}' RELEASES.md
fi
printf '\nPublishing Completed\n'
} > "$BODY_FILE"

# PEP 440 prerelease tokens: aN / bN / rcN / .devN / .postN-with-dev
PRERELEASE_FLAG=""
if [[ "$VERSION" =~ (a|b|rc|\.dev)[0-9]+ ]]; then
PRERELEASE_FLAG="--prerelease"
fi

if gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "Release $TAG already exists, skipping."
exit 0
fi

gh release create "$TAG" \
--repo "$GITHUB_REPOSITORY" \
--target "$GITHUB_SHA" \
--title "python - ${TAG} - ${INVOKE_TIME}" \
--notes-file "$BODY_FILE" \
$PRERELEASE_FLAG
Loading