-
Notifications
You must be signed in to change notification settings - Fork 11
88 lines (74 loc) · 2.28 KB
/
Copy pathrelease.yml
File metadata and controls
88 lines (74 loc) · 2.28 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
86
87
88
name: release
# Triggered by `v*` tags. Builds and 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
services:
redis:
image: redis:7
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
PYTHON_ENV: ci
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
FMP_API_KEY: ${{ secrets.FMP_API_KEY }}
steps:
- uses: actions/checkout@v4
- name: install rops
uses: quantmind/rops/.github/actions/setup-rops@main
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_DEPLOYMENT }}
- name: install taplo
run: rops tools update taplo
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"
- name: Install uv
run: pip install -U pip uv
- name: Install dependencies
run: make install-dev
- name: run lint
run: make lint-check
- name: run tests
run: make tests
- 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