Skip to content
This repository was archived by the owner on May 26, 2025. It is now read-only.
Open
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
98 changes: 98 additions & 0 deletions .github/workflows/publish_to_npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Publish to npm

on:
push:
tags:
- 'v*' # Trigger on tags starting with 'v'
workflow_dispatch:
inputs:
package_version:
description: 'Version to publish (e.g., vX.Y, vX.Y.Z, vX.Y.ZaN, vX.Y.ZbN, vX.Y.ZrcN)'
required: true

jobs:
release:
runs-on: ubuntu-latest

defaults:
run:
working-directory: packages/typescript # Set working directory

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Print Head Commit SHA
run: |
echo "Head Commit SHA: ${{ github.sha }}"

- name: Validate And Extract Version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
INPUT_VALUE="${{ github.event.inputs.package_version }}"
else
INPUT_VALUE="${GITHUB_REF#refs/tags/}"
fi

echo "Tag/input value: $INPUT_VALUE"

# Validate tag/input format: vX.Y.Z, vX.Y, vX.Y.ZaN, vX.Y.ZbN, vX.Y.ZrcN
if [[ ! "$INPUT_VALUE" =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?(a[0-9]+|b[0-9]+|rc[0-9]+)?$ ]]; then
echo "Invalid tag/input format: $INPUT_VALUE"
echo "Allowed formats: vX.Y, vX.Y.Z, vX.Y.ZaN, vX.Y.ZbN, vX.Y.ZrcN"
exit 1
fi

PACKAGE_VERSION="${INPUT_VALUE#v}"

# Convert pre-release format; determine npm tag
if [[ "$PACKAGE_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)a([0-9]+)$ ]]; then
PACKAGE_VERSION="${BASH_REMATCH[1]}-alpha.${BASH_REMATCH[2]}"
NPM_TAG="alpha"
elif [[ "$PACKAGE_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)b([0-9]+)$ ]]; then
PACKAGE_VERSION="${BASH_REMATCH[1]}-beta.${BASH_REMATCH[2]}"
NPM_TAG="beta"
elif [[ "$PACKAGE_VERSION" =~ ^([0-9]+\.[0-9]+\.[0-9]+)rc([0-9]+)$ ]]; then
PACKAGE_VERSION="${BASH_REMATCH[1]}-rc.${BASH_REMATCH[2]}"
NPM_TAG="release-candidate"
else
NPM_TAG="latest"
fi

echo "PACKAGE_VERSION=$PACKAGE_VERSION"
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV

echo "NPM_TAG=$NPM_TAG"
echo "NPM_TAG=$NPM_TAG" >> $GITHUB_ENV

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org/'

- name: Update Version in package.json
run: npm version $PACKAGE_VERSION --no-git-tag-version

- name: Install dependencies (skip postinstall scripts)
run: npm ci --ignore-scripts

- name: Run Lint & Build
run: |
npm run lint || echo "::warning ::Lint warnings found"
npm run build

- name: Audit for vulnerabilities
run: npm audit --audit-level=high || echo "::warning ::Vulnerabilities found"

- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public --tag $NPM_TAG

- name: Display Published Package Info
run: |
PACKAGE_NAME=$(node -p "require('./package.json').name")
echo "Successfully published $PACKAGE_NAME@$PACKAGE_VERSION to npm with tag $NPM_TAG!"
echo "Install it using:"
echo -e "\tnpm install $PACKAGE_NAME@$PACKAGE_VERSION"
78 changes: 78 additions & 0 deletions .github/workflows/publish_to_pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Publish to PyPI

on:
push:
tags:
- 'v*' # Trigger on tags starting with 'v'
workflow_dispatch:
inputs:
package_version:
description: 'Version to publish (e.g., vX.Y, vX.Y.Z, vX.Y.ZaN, vX.Y.ZbN, vX.Y.ZrcN)'
required: true

jobs:
release:
runs-on: ubuntu-latest

permissions:
id-token: write # Required for Trusted Publisher authentication

defaults:
run:
working-directory: packages/python # Set working directory

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Print Head Commit SHA
run: |
echo "Head Commit SHA: ${{ github.sha }}"

- name: Validate And Extract Version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
INPUT_VALUE="${{ github.event.inputs.package_version }}"
else
INPUT_VALUE="${GITHUB_REF#refs/tags/}"
fi

echo "Tag/input value: $INPUT_VALUE"

# Validate tag/input format: vX.Y.Z, vX.Y, vX.Y.ZaN, vX.Y.ZbN, vX.Y.ZrcN
if [[ ! "$INPUT_VALUE" =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?(a[0-9]+|b[0-9]+|rc[0-9]+)?$ ]]; then
echo "Invalid tag/input format: $INPUT_VALUE"
echo "Allowed formats: vX.Y, vX.Y.Z, vX.Y.ZaN, vX.Y.ZbN, vX.Y.ZrcN"
exit 1
fi

PACKAGE_VERSION="${INPUT_VALUE#v}"
echo "PACKAGE_VERSION=$PACKAGE_VERSION"
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install build tools
run: |
pip install --upgrade build twine

- name: Build the package
run: |
python3 -m build

- name: Publish to PyPI using Trusted Publisher
run: |
twine upload dist/* --verbose

- name: Display Published Package Info
run: |
PACKAGE_NAME=$(python3 -c "import tomli; from pathlib import Path; \
content = Path('pyproject.toml').read_text(); \
print(tomli.loads(content)['project']['name'])")

echo "Successfully published $PACKAGE_NAME==$PACKAGE_VERSION to PyPI!"
echo "Install it using:"
echo -e "\tpip install $PACKAGE_NAME==$PACKAGE_VERSION"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"private": true,
"version": "0.9.0",
"version": "0.0.0",
"scripts": {
"generate-api-clients": "sh ./hack/generate-api-clients.sh",
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
15 changes: 11 additions & 4 deletions packages/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
[build-system]
requires = ["setuptools>=61.0"]
requires = [
"setuptools>=61.0",
"environs>=9.5.0,<10.0.0",
"daytona_api_client>=0.12.2,<1.0.0"
]
build-backend = "setuptools.build_meta"

[project]
name = "daytona_sdk"
version = "0.9.0"
dynamic = ["version"]
authors = [
{ name = "Vedran Jukic", email = "vedran.jukic@gmail.com" },
{ name = "dummy", email = "dummy@mail.com" }, # TODO: publish-pipeline; change to daytona-org
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to name = Daytona, email = [email protected]

]
description = "Python SDK for Daytona"
readme = "README.md"
Expand Down Expand Up @@ -35,4 +39,7 @@ dev = [
"pydoc-markdown>=4.8.2",
"black>=22.0.0",
"isort>=5.10.0"
]
]

[tool.setuptools.dynamic]
version = {attr = "daytona_sdk.__version__"}
15 changes: 0 additions & 15 deletions packages/python/setup.py

This file was deleted.

6 changes: 6 additions & 0 deletions packages/python/src/daytona_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
SessionExecuteRequest,
SessionExecuteResponse,
)
import os

__all__ = [
"Daytona",
Expand All @@ -17,3 +18,8 @@
"SessionExecuteRequest",
"SessionExecuteResponse"
]

def get_version():
return os.getenv("PACKAGE_VERSION", "0.0.0")

__version__ = get_version()
4 changes: 2 additions & 2 deletions packages/typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@daytonaio/sdk",
"version": "0.9.0",
"version": "0.0.0",
"description": "Daytona client library for AI Agents",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down Expand Up @@ -39,4 +39,4 @@
"uuid": "^11.0.3",
"@daytonaio/api-client": "~0.12.2"
}
}
}