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 1 commit
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
87 changes: 87 additions & 0 deletions .github/workflows/publish_to_npm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
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: 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" >> $GITHUB_ENV
# Determine npm tag based on version suffix
if [[ "$PACKAGE_VERSION" =~ a[0-9]+$ ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

We follow this convention for pre-releases

v0.0.0-alpha.1
v0.0.0-beta.2
v0.0.0-rc.3

Copy link
Member

Choose a reason for hiding this comment

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

@MDzaja this doesn't seem to be addressed

NPM_TAG="alpha"
elif [[ "$PACKAGE_VERSION" =~ b[0-9]+$ ]]; then
NPM_TAG="beta"
elif [[ "$PACKAGE_VERSION" =~ rc[0-9]+$ ]]; then
NPM_TAG="release-candidate"
else
NPM_TAG="latest"
fi
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"
73 changes: 73 additions & 0 deletions .github/workflows/publish_to_pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
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: 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" >> $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
17 changes: 12 additions & 5 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"
name = "daytona-sdk"
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"
}
}
}