-
Notifications
You must be signed in to change notification settings - Fork 2
85 lines (72 loc) · 2.52 KB
/
publish-sdk.yml
File metadata and controls
85 lines (72 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Publish SDK to PyPI
permissions:
contents: write
on:
workflow_dispatch:
inputs:
version:
description: 'Version number (e.g., 0.1.0, 0.2.0)'
required: true
type: string
release_notes:
description: 'Release notes'
required: false
type: string
default: 'Bug fixes and improvements'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
pip install -e ".[dev]"
- name: Update version in setup.py
run: |
sed -i "s/version=\".*\"/version=\"${{ inputs.version }}\"/" setup.py
- name: Update version in pyproject.toml
run: |
sed -i "s/version = \".*\"/version = \"${{ inputs.version }}\"/" pyproject.toml
- name: Run tests
run: |
# Run mypy
mypy dataspace_sdk/ --ignore-missing-imports --config-file=/dev/null
# Run pytest
pytest tests/test_auth.py tests/test_base.py tests/test_client.py tests/test_datasets.py tests/test_aimodels.py tests/test_usecases.py tests/test_exceptions.py -v -p no:django -o addopts= --override-ini=django_find_project=false --noconftest --cov=dataspace_sdk --cov-report=term-missing
- name: Build package
run: |
python -m build
- name: Check package
run: |
twine check dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/*
- name: Commit version changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add setup.py pyproject.toml
git commit -m "Bump version to ${{ inputs.version }}" || echo "No changes to commit"
git push || echo "No changes to push"
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ inputs.version }}
release_name: SDK v${{ inputs.version }}
body: ${{ inputs.release_notes }}
draft: false
prerelease: false