Add funding info and update workflows
Added a FUNDING.yml file to specify sponsorship details. Updated the CI workflow to include a new job for updating badges and improved PyPI version handling. Modified README badges and CLI to include a banner print function and adjusted version display.
This commit is contained in:
1 parent
c26273fd79
commit
12fe2a8d5e
4 files changed
+67
-7
No files matched your search
@@ -0,0 +1 @@
|
||||
custom: https://xi-xu.me/#sponsorships
|
||||
@@ -85,7 +85,7 @@ jobs:
|
||||
name: pypi
|
||||
url: https://pypi.org/p/tzst
|
||||
permissions:
|
||||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
||||
id-token: write
|
||||
|
||||
steps:
|
||||
- name: Download build artifacts
|
||||
@@ -96,3 +96,53 @@ jobs:
|
||||
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@release/v1
|
||||
|
||||
update_badges:
|
||||
needs: [build, publish]
|
||||
if: always() && needs.build.result == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
|
||||
|
||||
- name: Wait if this is after a publish
|
||||
if: github.event_name == 'release' && github.event.action == 'published'
|
||||
run: sleep 30
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.11"
|
||||
|
||||
- name: Fetch PyPI version
|
||||
id: pypi_version
|
||||
run: |
|
||||
pip install requests
|
||||
python -c "
|
||||
import requests, json
|
||||
try:
|
||||
data = requests.get('https://pypi.org/pypi/tzst/json').json()
|
||||
version = data['info']['version']
|
||||
print(f'PyPI version: {version}')
|
||||
except Exception as e:
|
||||
print(f'Error fetching version: {e}')
|
||||
version = 'unknown'
|
||||
print(f'::set-output name=version::{version}')
|
||||
"
|
||||
|
||||
- name: Update README badge
|
||||
run: |
|
||||
echo "Updating PyPI badge with version: ${{ steps.pypi_version.outputs.version }}"
|
||||
git config --local user.email "action@github.com"
|
||||
git config --local user.name "GitHub Action"
|
||||
|
||||
- name: Commit and push changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "Update badges [skip ci]"
|
||||
file_pattern: README.md
|
||||
branch: ${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
A Python library for creating and manipulating `.tzst`/`.tar.zst` archives using Zstandard compression.
|
||||
|
||||
[](https://github.com/xixu-me/tzst/actions)
|
||||
[](https://badge.fury.io/py/tzst)
|
||||
[](https://pypi.org/project/tzst/)
|
||||
[](https://opensource.org/licenses/BSD-3-Clause)
|
||||
[](https://github.com/xixu-me/tzst/actions/workflows/ci.yml)
|
||||
[](https://pypi.org/project/tzst/)
|
||||
[](LICENSE)
|
||||
[](https://xi-xu.me/#sponsorships)
|
||||
|
||||
## Features
|
||||
|
||||
@@ -30,7 +30,7 @@ pip install tzst
|
||||
```bash
|
||||
git clone https://github.com/xixu-me/tzst.git
|
||||
cd tzst
|
||||
pip install -e .
|
||||
pip install .
|
||||
```
|
||||
|
||||
### Development Installation
|
||||
|
||||
+10
-1
@@ -10,6 +10,12 @@ from .core import create_archive, extract_archive, list_archive, test_archive
|
||||
from .exceptions import TzstArchiveError, TzstDecompressionError
|
||||
|
||||
|
||||
def print_banner() -> None:
|
||||
"""Print the version and copyright banner."""
|
||||
print()
|
||||
print(f"tzst {__version__} : Copyright (c) 2025 Xi Xu")
|
||||
|
||||
|
||||
def format_size(size: int) -> str:
|
||||
"""Format file size in human-readable format."""
|
||||
size_float = float(size)
|
||||
@@ -240,7 +246,7 @@ Command Reference:
|
||||
parser.add_argument(
|
||||
"--version",
|
||||
action="version",
|
||||
version=f"tzst {__version__} : Copyright (c) 2025 Xi Xu",
|
||||
version=f"tzst {__version__}",
|
||||
)
|
||||
|
||||
subparsers = parser.add_subparsers(
|
||||
@@ -313,6 +319,9 @@ Command Reference:
|
||||
|
||||
def main(argv: Optional[List[str]] = None) -> int:
|
||||
"""Main entry point for the CLI."""
|
||||
print_banner()
|
||||
print()
|
||||
|
||||
parser = create_parser()
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
|
||||
Reference in new issue
Block a user