chore: setup auto deploy (#31)
Co-authored-by: Shubham Naik <shub@memgpt.ai>
This commit is contained in:
76
.github/workflows/release.yml
vendored
76
.github/workflows/release.yml
vendored
@@ -1,14 +1,15 @@
|
|||||||
name: Release
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
tag:
|
version_type:
|
||||||
description: "Optional tag (e.g. v0.1.2). Leave blank when running from a tag push."
|
description: "Version bump type (patch, minor, major)"
|
||||||
required: false
|
required: false
|
||||||
push:
|
default: "patch"
|
||||||
tags:
|
|
||||||
- "v*"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
@@ -16,25 +17,67 @@ jobs:
|
|||||||
environment: npm-publish
|
environment: npm-publish
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
# Skip if this is a version bump commit to avoid infinite loop
|
||||||
|
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, 'chore: bump version')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Verify tag matches package version
|
- name: Configure Git
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
|
||||||
run: |
|
run: |
|
||||||
PKG_VERSION=$(jq -r '.version' package.json)
|
git config user.name "github-actions[bot]"
|
||||||
TAG_VERSION=${GITHUB_REF#refs/tags/}
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
if [ "v${PKG_VERSION}" != "${TAG_VERSION}" ]; then
|
|
||||||
echo "Tag (${TAG_VERSION}) does not match package.json version (v${PKG_VERSION})."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: Setup Bun
|
||||||
uses: oven-sh/setup-bun@v1
|
uses: oven-sh/setup-bun@v1
|
||||||
with:
|
with:
|
||||||
bun-version: 1.3.0
|
bun-version: 1.3.0
|
||||||
|
|
||||||
|
- name: Bump version
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
VERSION_TYPE="${{ github.event.inputs.version_type || 'patch' }}"
|
||||||
|
OLD_VERSION=$(jq -r '.version' package.json)
|
||||||
|
|
||||||
|
# Split version into parts
|
||||||
|
IFS='.' read -ra VERSION_PARTS <<< "$OLD_VERSION"
|
||||||
|
MAJOR=${VERSION_PARTS[0]}
|
||||||
|
MINOR=${VERSION_PARTS[1]}
|
||||||
|
PATCH=${VERSION_PARTS[2]}
|
||||||
|
|
||||||
|
# Bump based on type
|
||||||
|
if [ "$VERSION_TYPE" = "major" ]; then
|
||||||
|
MAJOR=$((MAJOR + 1))
|
||||||
|
MINOR=0
|
||||||
|
PATCH=0
|
||||||
|
elif [ "$VERSION_TYPE" = "minor" ]; then
|
||||||
|
MINOR=$((MINOR + 1))
|
||||||
|
PATCH=0
|
||||||
|
else
|
||||||
|
PATCH=$((PATCH + 1))
|
||||||
|
fi
|
||||||
|
|
||||||
|
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
||||||
|
|
||||||
|
# Update package.json
|
||||||
|
jq --arg version "$NEW_VERSION" '.version = $version' package.json > package.json.tmp
|
||||||
|
mv package.json.tmp package.json
|
||||||
|
|
||||||
|
echo "old_version=$OLD_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "tag=v$NEW_VERSION" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Commit and push version bump
|
||||||
|
run: |
|
||||||
|
git add package.json
|
||||||
|
git commit -m "chore: bump version to ${{ steps.version.outputs.new_version }} [skip ci]"
|
||||||
|
git tag "${{ steps.version.outputs.tag }}"
|
||||||
|
git push origin main
|
||||||
|
git push origin "${{ steps.version.outputs.tag }}"
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -57,7 +100,12 @@ jobs:
|
|||||||
- name: Create GitHub Release
|
- name: Create GitHub Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ github.ref_name }}
|
tag_name: ${{ steps.version.outputs.tag }}
|
||||||
|
name: Release ${{ steps.version.outputs.tag }}
|
||||||
|
body: |
|
||||||
|
Release ${{ steps.version.outputs.tag }}
|
||||||
|
|
||||||
|
Changes from ${{ steps.version.outputs.old_version }} to ${{ steps.version.outputs.new_version }}
|
||||||
files: letta.js
|
files: letta.js
|
||||||
fail_on_unmatched_files: true
|
fail_on_unmatched_files: true
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import { SYSTEM_PROMPT } from "./promptAssets";
|
|||||||
export async function createAgent(
|
export async function createAgent(
|
||||||
name = "letta-cli-agent",
|
name = "letta-cli-agent",
|
||||||
model = "anthropic/claude-sonnet-4-5-20250929",
|
model = "anthropic/claude-sonnet-4-5-20250929",
|
||||||
embeddingModel = "openai/text-embedding-3-small"
|
embeddingModel = "openai/text-embedding-3-small",
|
||||||
) {
|
) {
|
||||||
const client = await getClient();
|
const client = await getClient();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user