Skip to content

Commit f437811

Browse files
committed
Release django-stubs and django-stubs-ext
1 parent 86c007d commit f437811

File tree

5 files changed

+96
-12
lines changed

5 files changed

+96
-12
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Please, keep it in sync with `release-django-stubs-ext.yml`
2+
name: Release django-stubs-ext
3+
4+
on:
5+
push:
6+
tags:
7+
- 'django-stubs-ext@*'
8+
9+
jobs:
10+
build:
11+
environment:
12+
name: django-stubs-ext-pypi
13+
url: https://pypi.org/project/django-stubs-ext
14+
15+
if: github.repository == 'typeddjango/django-stubs'
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v3
20+
- uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.9'
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install -U pip
27+
python -m pip install -U setuptools twine wheel
28+
- name: Build package
29+
run: |
30+
cd ./django-stubs-ext
31+
python setup.py --version
32+
python setup.py sdist bdist_wheel
33+
34+
- name: Publish package to PyPI
35+
uses: pypa/gh-action-pypi-publish@release/v1
36+
with:
37+
user: __token__
38+
password: ${{ secrets.DJANGO_STUBS_PYPI_API_TOKEN }}
39+
packages_dir: './django-stubs-ext/dist'
40+
print_hash: true
41+
42+
- name: Create release
43+
uses: actions/github-script@v6
44+
with:
45+
script: |
46+
const tagName = context.ref.replace(/^refs\/tags\//, '');
47+
const release = await github.rest.repos.createRelease({
48+
owner: context.repo.owner,
49+
repo: context.repo.repo,
50+
tag_name: tagName,
51+
name: `Release of ${tagName} failed`,
52+
generate_release_notes: true,
53+
});
54+
55+
if (release.status < 200 || release.status >= 300) {
56+
core.setFailed(`Could not create release for tag '${tagName}'`);
57+
return;
58+
}
59+
60+
# https://github.community/t/run-github-actions-job-only-if-previous-job-has-failed/174786/2
61+
create-issue-on-failure:
62+
name: Create an issue if release failed
63+
runs-on: ubuntu-latest
64+
needs: [build]
65+
if: ${{ github.repository == 'typeddjango/django-stubs' && always() && needs.build.result == 'failure' }}
66+
permissions:
67+
issues: write
68+
steps:
69+
- uses: actions/github-script@v6
70+
with:
71+
script: |
72+
await github.rest.issues.create({
73+
owner: context.repo.owner,
74+
repo: context.repo.repo,
75+
title: `Release failure on ${new Date().toDateString()}`,
76+
body: `Details: https://github.com/${context.repo.owner}/${context.repo.repo}/actions/workflows/release.yml`,
77+
})

.github/workflows/release.yml renamed to .github/workflows/release-django-stubs.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
name: Release
1+
# Please, keep it in sync with `release-django-stubs-ext.yml`
2+
name: Release django-stubs
23

34
on:
45
push:
56
tags:
6-
- '*'
7+
- 'django-stubs@*'
78

89
jobs:
910
build:
11+
environment:
12+
name: django-stubs-pypi
13+
url: https://pypi.org/project/django-stubs
14+
1015
if: github.repository == 'typeddjango/django-stubs'
1116
runs-on: ubuntu-latest
1217

1318
steps:
1419
- uses: actions/checkout@v3
15-
1620
- uses: actions/setup-python@v4
1721
with:
1822
python-version: '3.9'
@@ -21,7 +25,6 @@ jobs:
2125
run: |
2226
python -m pip install -U pip
2327
python -m pip install -U setuptools twine wheel
24-
2528
- name: Build package
2629
run: |
2730
python setup.py --version
@@ -31,8 +34,8 @@ jobs:
3134
uses: pypa/gh-action-pypi-publish@release/v1
3235
with:
3336
user: __token__
34-
password: ${{ secrets.PYPI_API_TOKEN }}
35-
37+
password: ${{ secrets.DJANGO_STUBS_PYPI_API_TOKEN }}
38+
packages_dir: './dist'
3639
print_hash: true
3740

3841
- name: Create release
@@ -44,7 +47,7 @@ jobs:
4447
owner: context.repo.owner,
4548
repo: context.repo.repo,
4649
tag_name: tagName,
47-
name: `Release ${tagName.replace(/^v/, '')}`,
50+
name: `Release of ${tagName} failed`,
4851
generate_release_notes: true,
4952
});
5053

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ default_language_version:
44
python: python3.9
55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
7-
rev: v4.0.1
7+
rev: v4.3.0
88
hooks:
99
- id: check-yaml
1010
- id: trailing-whitespace
@@ -13,12 +13,12 @@ repos:
1313
- id: check-merge-conflict
1414
- id: end-of-file-fixer
1515
- repo: https://github.com/asottile/pyupgrade
16-
rev: v2.29.1
16+
rev: v2.34.0
1717
hooks:
1818
- id: pyupgrade
1919
args: ["--py36-plus"]
2020
- repo: https://github.com/pre-commit/mirrors-isort
21-
rev: v5.9.3
21+
rev: v5.10.1
2222
hooks:
2323
- id: isort
2424
name: isort (python)

django_stubs_ext/setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name="django-stubs-ext",
15-
version="0.4.0",
15+
version="0.5.0",
1616
description="Monkey-patching and extensions for django-stubs",
1717
long_description=readme,
1818
long_description_content_type="text/markdown",
@@ -39,6 +39,7 @@
3939
"Framework :: Django :: 3.0",
4040
"Framework :: Django :: 3.1",
4141
"Framework :: Django :: 3.2",
42+
"Framework :: Django :: 4.0",
4243
],
4344
project_urls={
4445
"Release notes": "https://github.com/typeddjango/django-stubs/releases",

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ def find_stub_files(name: str) -> List[str]:
3636

3737
setup(
3838
name="django-stubs",
39-
version="1.11.1",
39+
version="1.12.0",
4040
description="Mypy stubs for Django",
4141
long_description=readme,
4242
long_description_content_type="text/markdown",
4343
license="MIT",
4444
url="https://github.com/typeddjango/django-stubs",
4545
author="Maksim Kurnikov",
4646
author_email="[email protected]",
47+
maintainer="Nikita Sobolev",
48+
maintainer_email="[email protected]",
4749
py_modules=[],
4850
python_requires=">=3.7",
4951
install_requires=dependencies,
@@ -65,6 +67,7 @@ def find_stub_files(name: str) -> List[str]:
6567
"Framework :: Django :: 3.0",
6668
"Framework :: Django :: 3.1",
6769
"Framework :: Django :: 3.2",
70+
"Framework :: Django :: 4.0",
6871
],
6972
project_urls={
7073
"Release notes": "https://github.com/typeddjango/django-stubs/releases",

0 commit comments

Comments
 (0)