@@ -13,24 +13,111 @@ jobs:
1313 continue-on-error : ${{ matrix.python-version == '3.15' }}
1414 steps :
1515 - uses : actions/checkout@v4
16- - uses : NiklasRosenstein/slap@gha/install/v1
16+ - uses : astral-sh/setup-uv@v5
1717 - uses : actions/setup-python@v5
1818 with :
1919 python-version : " ${{ matrix.python-version }}"
2020 allow-prereleases : true
21- - run : slap install --link --no-venv-check
22- - run : slap test
23- - run : slap publish --dry
21+ - run : uv sync --group dev
22+ - run : uv run pytest databind/src/ -vv
23+ - run : uv run black --check --config pyproject.toml databind/src/
24+ - run : uv run isort --check-only databind/src/
25+ - run : uv run flake8 databind/src/
26+ - if : matrix.python-version == '3.12'
27+ run : uv run mypy
28+ - run : uv build --package databind && uv build --package databind.core && uv build --package databind.json
2429
2530 documentation :
2631 runs-on : ubuntu-latest
2732 steps :
2833 - uses : actions/checkout@v4
29- - uses : NiklasRosenstein/slap@gha/install/v1
34+ - uses : astral-sh/setup-uv@v5
3035 - uses : actions/setup-python@v5
31- with : { python-version: "3.10 " }
32- - run : slap --version && slap install --only-extras docs --no-venv-check
33- - run : slap run --no-venv-check docs:build
36+ with : { python-version: "3.12 " }
37+ - run : uv sync --group docs
38+ - run : cd docs && uv run mkdocs build --site-dir _site
3439 - uses : JamesIves/github-pages-deploy-action@4.1.4
3540 with : { branch: gh-pages, folder: docs/_site, ssh-key: "${{ secrets.DEPLOY_KEY }}" }
3641 if : github.ref == 'refs/heads/develop'
42+
43+ build :
44+ if : startsWith(github.ref, 'refs/tags/')
45+ needs : test
46+ runs-on : ubuntu-latest
47+ strategy :
48+ matrix :
49+ package :
50+ - { name: "databind", artifact: "dist-databind" }
51+ - { name: "databind.core", artifact: "dist-databind-core" }
52+ - { name: "databind.json", artifact: "dist-databind-json" }
53+ steps :
54+ - uses : actions/checkout@v4
55+ - uses : astral-sh/setup-uv@v5
56+ - uses : actions/setup-python@v5
57+ with : { python-version: "3.12" }
58+ - run : uv build --package ${{ matrix.package.name }}
59+ - uses : actions/upload-artifact@v4
60+ with :
61+ name : ${{ matrix.package.artifact }}
62+ path : dist/
63+
64+ publish :
65+ needs : build
66+ runs-on : ubuntu-latest
67+ environment : pypi
68+ permissions :
69+ id-token : write
70+ steps :
71+ - uses : actions/download-artifact@v4
72+ with : { name: dist-databind, path: dist/databind }
73+ - uses : actions/download-artifact@v4
74+ with : { name: dist-databind-core, path: dist/databind-core }
75+ - uses : actions/download-artifact@v4
76+ with : { name: dist-databind-json, path: dist/databind-json }
77+ - uses : pypa/gh-action-pypi-publish@release/v1
78+ with : { packages-dir: dist/databind }
79+ - uses : pypa/gh-action-pypi-publish@release/v1
80+ with : { packages-dir: dist/databind-core }
81+ - uses : pypa/gh-action-pypi-publish@release/v1
82+ with : { packages-dir: dist/databind-json }
83+
84+ github-release :
85+ needs : publish
86+ runs-on : ubuntu-latest
87+ permissions :
88+ contents : write
89+ steps :
90+ - uses : actions/checkout@v4
91+ - name : Generate release notes
92+ id : notes
93+ run : |
94+ VERSION="${GITHUB_REF#refs/tags/}"
95+ CHANGELOG=".changelog/${VERSION}.toml"
96+ if [ ! -f "$CHANGELOG" ]; then
97+ echo "body=Release ${VERSION}" >> "$GITHUB_OUTPUT"
98+ else
99+ BODY=$(python3 -c "
100+ import tomllib, pathlib, sys
101+ data = tomllib.loads(pathlib.Path(sys.argv[1]).read_text())
102+ lines = []
103+ for e in data.get('entries', []):
104+ t = e.get('type', 'change')
105+ d = e.get('description', '')
106+ pr = e.get('pr', '')
107+ suffix = f' ({pr})' if pr else ''
108+ lines.append(f'- **{t}**: {d}{suffix}')
109+ print('\n'.join(lines) if lines else 'No changelog entries.')
110+ " "$CHANGELOG")
111+ {
112+ echo "body<<GHEOF"
113+ echo "$BODY"
114+ echo "GHEOF"
115+ } >> "$GITHUB_OUTPUT"
116+ fi
117+ - name : Create GitHub Release
118+ env :
119+ GH_TOKEN : ${{ github.token }}
120+ run : |
121+ gh release create "${{ github.ref_name }}" \
122+ --title "${{ github.ref_name }}" \
123+ --notes "${{ steps.notes.outputs.body }}"
0 commit comments