Skip to content
Merged
Show file tree
Hide file tree
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
63 changes: 55 additions & 8 deletions .github/workflows/prompty-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,92 @@ on:
push:
tags:
- 'rust/*'
pull_request:
types: [closed]
paths:
- 'runtime/rust/**'
- '.github/workflows/prompty-rust.yml'
workflow_dispatch:

permissions:
contents: read

jobs:
test:
if: |
github.event_name != 'pull_request' ||
(github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'release: rust'))
uses: ./.github/workflows/prompty-rust-check.yml

publish:
name: publish to crates.io
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/rust/')
if: |
startsWith(github.ref, 'refs/tags/rust/') ||
(github.event_name == 'pull_request' &&
github.event.pull_request.merged == true &&
contains(github.event.pull_request.labels.*.name, 'release: rust'))
permissions:
contents: read
contents: write
defaults:
run:
working-directory: runtime/rust
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.merge_commit_sha || github.ref }}

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Verify tag matches source version
- name: Resolve release version
run: |
TAG_VERSION="${GITHUB_REF_NAME#rust/}"
SOURCE_VERSION=$(grep '^version' prompty/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
echo "tag=$TAG_VERSION source=$SOURCE_VERSION"
if [ "$TAG_VERSION" != "$SOURCE_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match source version ($SOURCE_VERSION). Run the release script to bump versions before tagging."
exit 1

if [[ "$GITHUB_REF" == refs/tags/rust/* ]]; then
TAG_VERSION="${GITHUB_REF_NAME#rust/}"
echo "tag=$TAG_VERSION source=$SOURCE_VERSION"
if [ "$TAG_VERSION" != "$SOURCE_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match source version ($SOURCE_VERSION). Run the release script to bump versions before tagging."
exit 1
fi
else
TAG_VERSION="$SOURCE_VERSION"
echo "release-pr-version=$TAG_VERSION"
fi

echo "VERSION=$TAG_VERSION" >> "$GITHUB_ENV"
echo "TAG_NAME=rust/$TAG_VERSION" >> "$GITHUB_ENV"

- name: Verify build
run: cargo build --workspace

- name: Verify package contents
run: cargo package --workspace --locked

- name: Create release tag from merged PR
if: github.event_name == 'pull_request'
working-directory: .
run: |
if git ls-remote --exit-code --tags origin "refs/tags/$TAG_NAME" >/dev/null 2>&1; then
git fetch --depth=1 origin "refs/tags/$TAG_NAME:refs/tags/$TAG_NAME"
TAG_SHA=$(git rev-list -n 1 "$TAG_NAME")
HEAD_SHA=$(git rev-parse HEAD)
if [ "$TAG_SHA" != "$HEAD_SHA" ]; then
echo "::error::Tag $TAG_NAME already exists at $TAG_SHA, not current release commit $HEAD_SHA."
exit 1
fi
echo "$TAG_NAME already exists on this commit; continuing."
else
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag -a "$TAG_NAME" -m "$TAG_NAME"
git push origin "refs/tags/$TAG_NAME"
fi

# Publish in dependency order — each crate must be available before its dependents.
# publish_crate helper: skips if already published, retries on index lag.
- name: Publish crates
Expand Down
5 changes: 5 additions & 0 deletions runtime/go/prompty/model/model_capabilities.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
"inputModalities": ["text"],
"outputModalities": []
},
{
"prefix": "gpt-image-1",
"inputModalities": ["text", "image"],
"outputModalities": ["image"]
},
{
"prefix": "dall-e-3",
"inputModalities": ["text"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
"inputModalities": ["text"],
"outputModalities": []
},
{
"prefix": "gpt-image-1",
"inputModalities": ["text", "image"],
"outputModalities": ["image"]
},
{
"prefix": "dall-e-3",
"inputModalities": ["text"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
"inputModalities": ["text"],
"outputModalities": []
},
{
"prefix": "gpt-image-1",
"inputModalities": ["text", "image"],
"outputModalities": ["image"]
},
{
"prefix": "dall-e-3",
"inputModalities": ["text"],
Expand Down
2 changes: 1 addition & 1 deletion runtime/rust/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
OPENAI_API_KEY=
OPENAI_MODEL=gpt-4o-mini
OPENAI_EMBEDDING_MODEL=text-embedding-3-small
OPENAI_IMAGE_MODEL=dall-e-2
OPENAI_IMAGE_MODEL=gpt-image-1

# Azure OpenAI / Foundry
AZURE_OPENAI_API_KEY=
Expand Down
Loading
Loading