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
114 changes: 114 additions & 0 deletions .github/workflows/publish-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Publish Python SDK

on:
push:
tags:
- 'swig-developer-sdk@*'

permissions:
contents: read

concurrency:
group: publish-python-${{ github.ref }}
cancel-in-progress: false

jobs:
build:
name: Build Python package
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/developer-sdk/python
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install uv and Python
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
python-version: '3.10'
working-directory: packages/developer-sdk/python
enable-cache: true

- name: Verify release tag
shell: bash
run: |
package_version="$(uv version --short --locked)"
expected_tag="swig-developer-sdk@${package_version}"
if [[ "${GITHUB_REF_NAME}" != "${expected_tag}" ]]; then
echo "Expected tag ${expected_tag}, got ${GITHUB_REF_NAME}" >&2
exit 1
fi
git fetch origin main
if ! git merge-base --is-ancestor HEAD origin/main; then
echo "Release tag must point to a commit on main" >&2
exit 1
fi

- name: Install dependencies
run: uv sync --frozen --all-groups

- name: Check formatting
run: uv run --frozen ruff format --check src tests scripts

- name: Check linting
run: uv run --frozen ruff check src tests scripts

- name: Check types
run: uv run --frozen mypy src scripts

- name: Run tests
run: uv run --frozen pytest

- name: Build package
run: uv build

- name: Upload package distributions
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: packages/developer-sdk/python/dist/
if-no-files-found: error

publish:
name: Publish package to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/swig-developer-sdk
permissions:
id-token: write
steps:
- name: Download package distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: Create GitHub release
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download package distributions
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/

- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: >-
gh release create "${GITHUB_REF_NAME}" dist/*
--repo "${GITHUB_REPOSITORY}"
--title "${GITHUB_REF_NAME}"
--generate-notes
2 changes: 1 addition & 1 deletion packages/developer-sdk/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "swig-developer-sdk"
version = "0.6.0"
version = "0.7.0"
description = "Python SDK for preparing and locally signing Swig wallet transactions"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
2 changes: 1 addition & 1 deletion packages/developer-sdk/python/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading