Skip to content

Commit

Permalink
👷 ci: release
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgramRipper committed Oct 6, 2023
1 parent ddadf84 commit 3e3ec7b
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/actions/setup-python/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ runs:

- name: Install dependencies
run: pdm install
shell: bash
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Release

on:
push:
tags:
- v*

permissions:
id-token: write
contents: write

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup Python
uses: ./.github/actions/setup-python

- name: Get version
id: version
run: |
echo "VERSION=$(pdm show --version)" >> $GITHUB_OUTPUT
echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Check version
if: steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION
run: exit 1

- name: Build package
run: pdm build

- name: Upload dist
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/*

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

- name: Publish package to GitHub
run: |
gh release create ${{ steps.version.outputs.TAG_NAME }} dist/* \
-t "🔖 Release ${{ steps.version.outputs.VERSION }}" --generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions nonebot_plugin_orm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@
)


_binds: dict[type[Model], AsyncEngine] = None # type:ignore
_engines: dict[str, AsyncEngine] = None # type: ignore
_metadatas: dict[str, MetaData] = None # type: ignore
_session_factory: async_sessionmaker[AsyncSession] = None # type: ignore
_binds: dict[type[Model], AsyncEngine]
_engines: dict[str, AsyncEngine]
_metadatas: dict[str, MetaData]
_session_factory: async_sessionmaker[AsyncSession]


@get_driver().on_startup
Expand Down
2 changes: 2 additions & 0 deletions nonebot_plugin_orm/templates/generic/script.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
创建时间: ${create_date}

"""
from __future__ import annotations

from collections.abc import Sequence

from alembic import op
Expand Down
2 changes: 2 additions & 0 deletions nonebot_plugin_orm/templates/multidb/script.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
创建时间: ${create_date}

"""
from __future__ import annotations

from collections.abc import Sequence
from contextlib import suppress

Expand Down

0 comments on commit 3e3ec7b

Please sign in to comment.