Repository navigation
83 lines (73 loc) · 2.76 KB
/
Copy pathrelease.yml
File metadata and controls
83 lines (73 loc) · 2.76 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
name: Release
on:
push:
tags: ["v*"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- name: Assert tag matches pyproject version
run: |
TAG="${GITHUB_REF_NAME#v}"
VERSION="$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml","rb"))["project"]["version"])')"
if [ "$TAG" != "$VERSION" ]; then
echo "Tag v$TAG does not match pyproject version $VERSION" >&2
exit 1
fi
- name: Build
run: uv build
- name: Assert wheel contents
# Same guard as CI: a packaging change that drops the macros or config
# files produces a wheel that imports fine but cannot run a model.
run: |
python3 - <<'EOF'
import glob, sys, zipfile
wheel = glob.glob("dist/*.whl")[0]
names = set(zipfile.ZipFile(wheel).namelist())
required = [
"dbt/adapters/hotdata/__init__.py",
"dbt/adapters/hotdata/__version__.py",
"dbt/adapters/hotdata/client.py",
"dbt/adapters/hotdata/column.py",
"dbt/adapters/hotdata/connections.py",
"dbt/adapters/hotdata/credentials.py",
"dbt/adapters/hotdata/impl.py",
"dbt/adapters/hotdata/relation.py",
"dbt/adapters/hotdata/seeds.py",
"dbt/include/hotdata/__init__.py",
"dbt/include/hotdata/dbt_project.yml",
"dbt/include/hotdata/profile_template.yml",
"dbt/include/hotdata/macros/adapters.sql",
"dbt/include/hotdata/macros/materializations/table.sql",
"dbt/include/hotdata/macros/materializations/incremental.sql",
"dbt/include/hotdata/macros/materializations/seed.sql",
"dbt/include/hotdata/macros/materializations/view.sql",
"dbt/include/hotdata/macros/materializations/snapshot.sql",
]
missing = [name for name in required if name not in names]
if missing:
sys.exit(f"wheel {wheel} is missing: {missing}")
print(f"ok: {wheel} contains all {len(required)} required files")
EOF
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/dbt-hotdata/
permissions:
# Required for PyPI trusted publishing (OIDC) — no API token needed.
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1