Skip to content

Commit

Permalink
actions fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jaddek committed Feb 13, 2025
1 parent 47b1674 commit 219a613
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 73 deletions.
71 changes: 0 additions & 71 deletions .github/workflows/build.yml

This file was deleted.

127 changes: 127 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Build

on:
push:
tags:
- 'v*'
branches:
- 'main'
- 'dev'
- 'feature/*'
- 'hotfix/*'

jobs:

build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.26"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Install the project
run: uv sync

- name: Build the project
run: uv build

- name: Upload built artifacts
uses: actions/upload-artifact@v4
with:
name: package
path: dist/*

tests:
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]

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

- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.26"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Set PYTHONPATH (Linux/macOS)
if: runner.os != 'Windows'
run: echo "PYTHONPATH=$PWD/src" >> $GITHUB_ENV
shell: bash

- name: Set PYTHONPATH (Windows)
if: runner.os == 'Windows'
run: echo PYTHONPATH=%CD%\src >> %GITHUB_ENV%
shell: cmd

- name: Install the project
run: uv sync --all-extras --dev

- name: Run Ruff
run: uv run ruff check

- name: Run Pytests
run: uv run pytest tests

publish:
runs-on: ubuntu-latest
needs: [build, tests]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-tags: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Download built artifacts
uses: actions/download-artifact@v4
with:
path: dist


- name: Get latest tag and update pyproject.toml
run: |
VERSION=$(git describe --tags --abbrev=0 | sed 's/^v//')
echo "Using version: $VERSION"
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
version: "0.5.26"
enable-cache: true
cache-dependency-glob: "uv.lock"

- name: Upload to PyPI
env:
PYPI_USERNAME: ${{ secrets.PP_UN }}
PYPI_PASSWORD: ${{ secrets.PP_TK }}
UV_PUBLISH_TOKEN: ${{ secrets.PP_TK }}
run: |
uv build
uv publish
- name: Clean up
run: |
rm -rf dist
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "jaddek_tillo_sdk"
version = "0.1.4"
description = "Tillo SDK"
description = "The package for developers to interact with the Tillo APIv2"
authors = [
{ name = "Anton Nazarov", email = "[email protected]" }
]
readme = "README.md"
requires-python = ">=3.9"

license = "MIT"
dependencies = [
"httpx[http2]>=0.28.1,<0.29.0",
]
Expand All @@ -23,6 +28,7 @@ dev = [

[project.urls]
Homepage = "https://github.com/jaddek/tillo-sdk-python"
Issues = "https://github.com/jaddek/tillo-sdk-python/issues"


[tool.bumpversion]
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

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

0 comments on commit 219a613

Please sign in to comment.