-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (79 loc) · 2.37 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (79 loc) · 2.37 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: release
# Triggered by `v*` tags (push one with `make release`). Runs the test suite,
# publishes the package to PyPI, then extracts the matching section from
# docs/release-notes.md and publishes it as the GitHub Release body. Re-runs
# idempotently update an existing release rather than failing.
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
PYTHON_ENV: ci
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
FLUID_FLAMEGRAPH_EXECUTABLE: "./flamegraph.pl"
services:
postgres:
image: postgres:15
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: test_db
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Start Redis
uses: supercharge/redis-github-action@1.2.0
with:
redis-version: 7
- name: Install dependencies
run: make install
- name: Install flamegraph
env:
FG_PATH: "."
run: ./.dev/install-flamegraph
- name: run lint
run: make lint-test
- name: build docs
run: make docs
- name: tests
run: make test
- name: publish to PyPI
run: make publish
- name: Extract release notes
run: |
TAG="${GITHUB_REF_NAME}"
awk -v tag="## ${TAG}" '
$0 == tag { in_section = 1; next }
/^## / && in_section { exit }
in_section { print }
' docs/release-notes.md > /tmp/notes.md
if [ ! -s /tmp/notes.md ]; then
echo "No section '## ${TAG}' found in docs/release-notes.md" >&2
exit 1
fi
echo "--- extracted notes for ${TAG} ---"
cat /tmp/notes.md
- name: Publish GitHub Release
run: |
TAG="${GITHUB_REF_NAME}"
if gh release view "$TAG" >/dev/null 2>&1; then
gh release edit "$TAG" --notes-file /tmp/notes.md
else
gh release create "$TAG" --title "$TAG" --notes-file /tmp/notes.md
fi