Skip to content
Closed
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
93 changes: 93 additions & 0 deletions .github/workflows/python-release-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Python Release (Test - TestPyPI)

on:
push:
branches:
- ma/release

permissions:
contents: read
id-token: write # Required for PyPI trusted publishing

jobs:
validate:
name: "py: validate"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install Python 3.13
run: uv python install 3.13

- name: Install dependencies
run: uv sync --frozen --group dev

- name: Lint
run: uv run -- ruff check --output-format=github python

- name: Format check
run: uv run -- ruff format --diff python

- name: Type check
run: uv run -- mypy python

- name: Test
run: uv run -- pytest

verify-version:
name: "py: verify version"
runs-on: ubuntu-latest
needs: validate

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup uv
uses: astral-sh/setup-uv@v6

- name: Install Python 3.13
run: uv python install 3.13

- name: Read pyproject.toml version
id: package
run: |
VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('python/ampersend-sdk/pyproject.toml', 'rb'))['project']['version'])")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "📦 Package version: $VERSION"

publish:
name: "py: publish to TestPyPI"
runs-on: ubuntu-latest
needs: [validate, verify-version]
environment:
name: test-pypi
url: https://test.pypi.org/p/ampersend-sdk

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup uv
uses: astral-sh/setup-uv@v6

- name: Install Python 3.13
run: uv python install 3.13

- name: Build package
run: uv build --package ampersend-sdk

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist/
92 changes: 92 additions & 0 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Python Release

on:
push:
branches:
- ma/release

permissions:
contents: read
id-token: write # Required for PyPI trusted publishing

jobs:
validate:
name: "py: validate"
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install Python 3.13
run: uv python install 3.13

- name: Install dependencies
run: uv sync --frozen --group dev

- name: Lint
run: uv run -- ruff check --output-format=github python

- name: Format check
run: uv run -- ruff format --diff python

- name: Type check
run: uv run -- mypy python

- name: Test
run: uv run -- pytest

verify-version:
name: "py: verify version"
runs-on: ubuntu-latest
needs: validate

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup uv
uses: astral-sh/setup-uv@v6

- name: Install Python 3.13
run: uv python install 3.13

- name: Read pyproject.toml version
id: package
run: |
VERSION=$(uv run python -c "import tomllib; print(tomllib.load(open('python/ampersend-sdk/pyproject.toml', 'rb'))['project']['version'])")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Package version: $VERSION"

publish:
name: "py: publish to PyPI"
runs-on: ubuntu-latest
needs: [validate, verify-version]
environment:
name: pypi
url: https://pypi.org/p/ampersend-sdk

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Setup uv
uses: astral-sh/setup-uv@v6

- name: Install Python 3.13
run: uv python install 3.13

- name: Build package
run: uv build --package ampersend-sdk

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
123 changes: 123 additions & 0 deletions .github/workflows/typescript-release-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: TypeScript Release (Test - GitHub Packages)

on:
push:
branches:
- ma/release

permissions:
contents: read
packages: write # Required for GitHub Packages

env:
NODE_VERSION: "22.x"

jobs:
validate:
name: "ts: validate"
runs-on: ubuntu-latest
timeout-minutes: 10
env:
NODE_OPTIONS: --max-old-space-size=6144

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

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: package.json

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm --filter ampersend-sdk build

- name: Lint
run: pnpm --filter ampersend-sdk lint

- name: Format
run: pnpm --filter ampersend-sdk format

- name: Type check
run: pnpm --filter ampersend-sdk typecheck

- name: Test
run: pnpm --filter ampersend-sdk test

verify-version:
name: "ts: verify version"
runs-on: ubuntu-latest
needs: validate

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

- name: Read package.json version
id: package
run: |
VERSION=$(node -p "require('./typescript/packages/ampersend-sdk/package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "📦 Package version: $VERSION"

publish:
name: "ts: publish to GitHub Packages"
runs-on: ubuntu-latest
needs: [validate, verify-version]
environment:
name: github-packages
url: https://github.com/edgeandnode/ampersend-sdk/packages

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

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: package.json

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: "https://npm.pkg.github.com"
scope: "@edgeandnode"
cache: "pnpm"
cache-dependency-path: pnpm-lock.yaml

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build package
run: pnpm --filter ampersend-sdk build

- name: Determine publish tag
id: publish-tag
run: |
VERSION=$(node -p "require('./typescript/packages/ampersend-sdk/package.json').version")
if [[ "$VERSION" == *"-alpha."* ]]; then
echo "tag=alpha" >> $GITHUB_OUTPUT
echo "📌 Publishing with tag: alpha"
elif [[ "$VERSION" == *"-beta."* ]]; then
echo "tag=beta" >> $GITHUB_OUTPUT
echo "📌 Publishing with tag: beta"
else
echo "tag=latest" >> $GITHUB_OUTPUT
echo "📌 Publishing with tag: latest"
fi

- name: Publish to GitHub Packages
run: pnpm --filter ampersend-sdk publish --no-git-checks --access public --tag ${{ steps.publish-tag.outputs.tag }} --registry https://npm.pkg.github.com
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading