Skip to content

Commit 1cbd381

Browse files
committed
ci: apply review fixes, check docs, and use drafts
1 parent c6574d7 commit 1cbd381

File tree

1 file changed

+56
-33
lines changed

1 file changed

+56
-33
lines changed

.github/workflows/release.yml

Lines changed: 56 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,76 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'v*.*.*'
7-
8-
permissions:
9-
contents: write
6+
- '*'
107

118
jobs:
12-
test:
9+
gate-on-ci:
10+
name: Gate release on CI success for this tag commit
1311
runs-on: ubuntu-latest
14-
strategy:
15-
matrix:
16-
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.14t']
1712
steps:
18-
- name: Checkout code
19-
uses: actions/checkout@v6
20-
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v6
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
2215
with:
23-
python-version: ${{ matrix.python-version }}
24-
- name: Install dependencies
16+
fetch-depth: 0
17+
18+
- name: Check that release tag points to a develop commit
2519
run: |
26-
python -m pip install --upgrade pip
27-
pip install -r requirements.txt
28-
- name: Run tests
29-
run: pytest
20+
git merge-base --is-ancestor "$GITHUB_SHA" origin/develop
21+
22+
- name: Verify version string in documentation
23+
run: |
24+
VERSION=${GITHUB_REF_NAME#v}
25+
echo "Checking files for version: $VERSION"
26+
27+
for file in nltk/VERSION ChangeLog web/news.rst web/conf.py; do
28+
if grep -Fq "$VERSION" "$file"; then
29+
echo "✅ Found $VERSION in $file"
30+
else
31+
echo "❌ ERROR: Version $VERSION not found in $file!"
32+
exit 1
33+
fi
34+
done
35+
36+
- name: Wait for ci.yml to complete and verify success
37+
env:
38+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39+
run: |
40+
run=$(gh api repos/${{ github.repository }}/actions/commits/$GITHUB_SHA/runs --jq '.workflow_runs[] | select(.name == "CI") | head -n 1')
41+
conclusion=$(jq -r '.conclusion // empty' <<< "$run")
3042
31-
build-and-release:
43+
if [ "$conclusion" != "success" ]; then
44+
run_id=$(jq -r '.id // empty' <<<"$run")
45+
run_number=$(jq -r '.run_number // empty' <<<"$run")
46+
run_url="https://github.com/${{ github.repository }}/actions/runs/${run_id}"
47+
echo "CI failed with conclusion: ${conclusion:-unknown} (run #${run_number:-unknown}). See workflow run: ${run_url}"
48+
exit 1
49+
fi
50+
51+
build-and-github-release:
52+
needs: gate-on-ci
53+
name: Build and create GitHub draft release
3254
runs-on: ubuntu-latest
33-
needs: test
3455
steps:
35-
- name: Checkout code
36-
uses: actions/checkout@v6
37-
- name: Set up Python 3.14
38-
uses: actions/setup-python@v6
56+
- name: Checkout repository
57+
uses: actions/checkout@v4
58+
59+
- name: Set up Python
60+
uses: actions/setup-python@v5
3961
with:
40-
python-version: 3.14
41-
- name: Install dependencies
62+
python-version: '3.10'
63+
64+
- name: Install build dependencies
4265
run: |
4366
python -m pip install --upgrade pip
4467
pip install -r requirements.txt
4568
pip install build
46-
- name: Build distributions
69+
70+
- name: Build package
4771
run: python -m build
48-
- name: Upload Release Assets
72+
73+
- name: Create GitHub Release
4974
uses: softprops/action-gh-release@v2
5075
with:
51-
files: |
52-
dist/*.whl
53-
dist/*.tar.gz
54-
env:
55-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
files: dist/*
77+
draft: true
78+
generate_release_notes: true

0 commit comments

Comments
 (0)