-
Notifications
You must be signed in to change notification settings - Fork 5
114 lines (93 loc) · 3.08 KB
/
release-kosong.yml
File metadata and controls
114 lines (93 loc) · 3.08 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Release (kosong)
on:
push:
tags:
- "kosong-*"
permissions:
contents: read
jobs:
validate:
name: Validate tag
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: "3.14"
allow-prereleases: true
- name: Check version tag
run: |
python scripts/check_version_tag.py \
--pyproject packages/kosong/pyproject.toml \
--expected-version "${GITHUB_REF_NAME#kosong-}"
publish:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: "3.14"
allow-prereleases: true
- name: Set up uv
uses: astral-sh/setup-uv@v1
with:
version: "0.8.5"
- name: Build distributions
run: make build-kosong
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: dist/kosong
docs:
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: "3.14"
allow-prereleases: true
- name: Set up uv
uses: astral-sh/setup-uv@v1
with:
version: "0.8.5"
- name: Install dependencies
run: uv sync --frozen --all-extras --project packages/kosong
- name: Generate API documentation
run: |
VERSION="${GITHUB_REF_NAME#kosong-}"
uv run --project packages/kosong pdoc kosong \
--docformat google \
--footer-text "kosong ${VERSION}" \
-o packages/kosong/docs
- name: Disable Jekyll processing
run: touch packages/kosong/docs/.nojekyll
- name: Publish docs to gh-pages
env:
KOSONG_PAGES_TOKEN: ${{ secrets.KOSONG_PAGES_TOKEN }}
run: |
set -euo pipefail
VERSION="${GITHUB_REF_NAME#kosong-}"
PAGES_REPO="https://x-access-token:${KOSONG_PAGES_TOKEN}@github.com/MoonshotAI/kosong.git"
PAGES_DIR="${RUNNER_TEMP}/kosong-gh-pages"
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
rm -rf "$PAGES_DIR"
git clone --depth 1 --branch gh-pages "$PAGES_REPO" "$PAGES_DIR"
rsync -a --delete --exclude '.git' "packages/kosong/docs/" "$PAGES_DIR/"
git -C "$PAGES_DIR" add -A
if git -C "$PAGES_DIR" diff --cached --quiet; then
echo "No documentation changes to publish."
exit 0
fi
git -C "$PAGES_DIR" commit -m "docs: update for ${VERSION}"
git -C "$PAGES_DIR" push origin gh-pages