Skip to content

Commit 891f6da

Browse files
committed
Packaging
1 parent 51b0711 commit 891f6da

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

.github/workflows/python-publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
# This workflow will upload a Python Package using Twine when a release is created
3+
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
4+
5+
# This workflow uses actions that are not certified by GitHub.
6+
# They are provided by a third-party and are governed by
7+
# separate terms of service, privacy policy, and support
8+
# documentation.
9+
10+
name: Upload Python Package
11+
12+
on:
13+
release:
14+
types: [published]
15+
16+
permissions:
17+
contents: write
18+
19+
jobs:
20+
deploy:
21+
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
- name: Set up Python
27+
uses: actions/setup-python@v3
28+
with:
29+
python-version: '3.x'
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install build
34+
- name: Build package
35+
run: python -m build
36+
- name: Upload assets
37+
uses: softprops/action-gh-release@v1
38+
with:
39+
files: dist/**/*
40+
fail_on_unmatched_files: true
41+
- name: Publish package
42+
uses: pypa/gh-action-pypi-publish@release/v1
43+
with:
44+
user: __token__
45+
password: ${{ secrets.PYPI_API_TOKEN }}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
22
requires = [
3-
"setuptools >= 40.9.0",
3+
"setuptools >= 46.4.0",
44
"wheel",
55
]
66
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = luogu
3-
version = 0.0.1
3+
version = attr: luogu.__version__
44
author = 汪心禾
55
author_email = [email protected]
66
description = A model-based Python implement for Luogu API client

src/luogu/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
from .models.paste import Paste
1313
from .session import Session
1414

15+
__version__ = "0.0.1"
16+
1517
__all__ = (
1618
"AccessDeniedHttpException",
1719
"HttpException",

0 commit comments

Comments
 (0)