-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (64 loc) · 1.98 KB
/
Copy pathrelease.yml
File metadata and controls
70 lines (64 loc) · 1.98 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
name: release
on:
push:
tags:
- "v*"
permissions:
contents: read
jobs:
verify:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install package
run: python -m pip install --no-deps .
- name: Compile and test
run: |
python -m compileall -q src audit-local-files/scripts tests
for test in tests/*_test.py; do python "$test"; done
release:
needs: verify
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Verify tag and package version
env:
RELEASE_TAG: ${{ github.ref_name }}
run: |
python - <<'PY'
import os
import tomllib
from pathlib import Path
version = tomllib.loads(Path("pyproject.toml").read_text(encoding="utf-8"))["project"]["version"]
expected = f"v{version}"
if os.environ["RELEASE_TAG"] != expected:
raise SystemExit(f"release tag {os.environ['RELEASE_TAG']!r} must equal {expected!r}")
PY
- name: Build distributions
run: |
python -m pip install build twine
python -m build
python -m twine check dist/*
python - <<'PY'
import zipfile
from pathlib import Path
wheel = next(Path("dist").glob("*.whl"))
with zipfile.ZipFile(wheel) as archive:
names = set(archive.namelist())
assert "clean_your_data/web/index.html" in names
PY
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" dist/* --title "Clean Your Data $GITHUB_REF_NAME" --generate-notes