From 9b2f207c5b65cad960a3e6b3a992dedc60eae517 Mon Sep 17 00:00:00 2001 From: "aiste.grigaliunaite@decodo.com" Date: Fri, 16 Oct 2026 09:23:59 +0300 Subject: [PATCH 1/2] ci: set up semantic release --- .github/workflows/lint.yml | 4 +-- .github/workflows/pr-title.yml | 17 +++++++++++ .github/workflows/test.yml | 9 ++++-- .github/workflows/worklfow.yml | 56 +++++++++++++++++++++++++++------- CONTRIBUTING.md | 10 ++++++ pyproject.toml | 8 ++++- 6 files changed, 88 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/pr-title.yml create mode 100644 CONTRIBUTING.md diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 7cb71f5..5c4989b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,9 +10,9 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v7 with: python-version: "3.12" diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml new file mode 100644 index 0000000..b178665 --- /dev/null +++ b/.github/workflows/pr-title.yml @@ -0,0 +1,17 @@ +name: PR title + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +permissions: + pull-requests: read + +jobs: + conventional: + runs-on: ubuntu-latest + steps: + - name: Check PR title follows Conventional Commits + uses: amannn/action-semantic-pull-request@v6 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e7e55c7..bdb5129 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,9 +10,9 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v7 with: python-version: "3.12" @@ -24,3 +24,8 @@ jobs: - name: Pytest run: pytest + + - name: Build + run: | + pip install build + python -m build diff --git a/.github/workflows/worklfow.yml b/.github/workflows/worklfow.yml index 7b1f677..4243175 100644 --- a/.github/workflows/worklfow.yml +++ b/.github/workflows/worklfow.yml @@ -1,37 +1,71 @@ -name: Publish Python SDK to PyPI +name: Release on: push: branches: - main - workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: release + cancel-in-progress: false jobs: - publish: + release: runs-on: ubuntu-latest environment: pypi permissions: + contents: write id-token: write - contents: read + steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v7 + with: + ref: ${{ github.ref_name }} + fetch-depth: 0 + + - name: Reset to the workflow commit + run: git reset --hard ${{ github.sha }} - - uses: actions/setup-python@v5 + - name: Setup Python + uses: actions/setup-python@v7 with: python-version: "3.12" + - name: Install dependencies + run: pip install -e ".[dev]" httpx types-jsonschema + + - name: Ruff + run: ruff check . + + - name: Mypy + run: mypy . + - name: Generate types - run: | - pip install httpx pydantic jsonschema - pip install -e . - python -m decodo.codegen.codegen + run: python -m decodo.codegen.codegen + + - name: Pytest + run: pytest + + - name: Release + id: release + uses: python-semantic-release/python-semantic-release@v10.7.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + commit: "false" + changelog: "false" - name: Build + if: steps.release.outputs.released == 'true' run: | pip install build python -m build - - name: Publish + - name: Publish to PyPI + if: steps.release.outputs.released == 'true' uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: dist/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..5035fe9 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,10 @@ +# Contributing + +## Releases + +Releases are automated with python-semantic-release. Merging to `main` publishes a new +PyPI version based on the PR title, which must follow +[Conventional Commits](https://www.conventionalcommits.org) (a CI check enforces it): +`fix:` → patch, `feat:` → minor, `feat!:` or a `BREAKING CHANGE:` footer → major. +`chore:`, `docs:`, `ci:`, `refactor:`, `test:` don't release. Don't edit `version` in +`pyproject.toml`; the release job sets it at publish time. diff --git a/pyproject.toml b/pyproject.toml index 346d140..026ec5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "decodo-sdk" -version = "2.4.0" +version = "0.0.0" description = "Official Python SDK for the Decodo APIs" readme = "README.md" license = { file = "LICENSE" } @@ -65,3 +65,9 @@ ignore_errors = true [tool.pytest.ini_options] testpaths = ["tests"] +[tool.semantic_release] +version_toml = ["pyproject.toml:project.version"] +commit_parser = "conventional" + +[tool.semantic_release.branches.main] +match = "main" From 901ca241e48a5059fd40859934d256ff8a391031 Mon Sep 17 00:00:00 2001 From: "aiste.grigaliunaite@decodo.com" Date: Fri, 16 Oct 2026 11:02:27 +0300 Subject: [PATCH 2/2] chore: rename file --- .github/workflows/{worklfow.yml => workflow.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{worklfow.yml => workflow.yml} (100%) diff --git a/.github/workflows/worklfow.yml b/.github/workflows/workflow.yml similarity index 100% rename from .github/workflows/worklfow.yml rename to .github/workflows/workflow.yml