Skip to content

Commit 3e3ec7b

Browse files
committed
👷 ci: release
1 parent ddadf84 commit 3e3ec7b

File tree

5 files changed

+59
-4
lines changed

5 files changed

+59
-4
lines changed

.github/actions/setup-python/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ runs:
1818

1919
- name: Install dependencies
2020
run: pdm install
21+
shell: bash

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
permissions:
9+
id-token: write
10+
contents: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Setup Python
20+
uses: ./.github/actions/setup-python
21+
22+
- name: Get version
23+
id: version
24+
run: |
25+
echo "VERSION=$(pdm show --version)" >> $GITHUB_OUTPUT
26+
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
27+
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
28+
29+
- name: Check version
30+
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION
31+
run: exit 1
32+
33+
- name: Build package
34+
run: pdm build
35+
36+
- name: Upload dist
37+
uses: actions/upload-artifact@v3
38+
with:
39+
name: dist
40+
path: dist/*
41+
42+
- name: Publish package to PyPI
43+
uses: pypa/gh-action-pypi-publish@release/v1
44+
45+
- name: Publish package to GitHub
46+
run: |
47+
gh release create ${{ steps.version.outputs.TAG_NAME }} dist/* \
48+
-t "🔖 Release ${{ steps.version.outputs.VERSION }}" --generate-notes
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

nonebot_plugin_orm/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@
7171
)
7272

7373

74-
_binds: dict[type[Model], AsyncEngine] = None # type:ignore
75-
_engines: dict[str, AsyncEngine] = None # type: ignore
76-
_metadatas: dict[str, MetaData] = None # type: ignore
77-
_session_factory: async_sessionmaker[AsyncSession] = None # type: ignore
74+
_binds: dict[type[Model], AsyncEngine]
75+
_engines: dict[str, AsyncEngine]
76+
_metadatas: dict[str, MetaData]
77+
_session_factory: async_sessionmaker[AsyncSession]
7878

7979

8080
@get_driver().on_startup

nonebot_plugin_orm/templates/generic/script.py.mako

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
创建时间: ${create_date}
66

77
"""
8+
from __future__ import annotations
9+
810
from collections.abc import Sequence
911

1012
from alembic import op

nonebot_plugin_orm/templates/multidb/script.py.mako

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
创建时间: ${create_date}
66

77
"""
8+
from __future__ import annotations
9+
810
from collections.abc import Sequence
911
from contextlib import suppress
1012

0 commit comments

Comments
 (0)