Skip to content

Commit

Permalink
Add GitHub Actions workflow for publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim137 committed Apr 12, 2024
1 parent 168792b commit 5948a8b
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/to-pub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: build

on:
push:
branches:
- toPub

jobs:
pub_tools:
name: Run pub_tools
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run pub_tools
run: |
python ./pub_tools/pub.py
- name: Commit and push
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "Action@Github.com"
git add . || true
git commit -m "Auto version bump" || true
git push -u origin HEAD:HEAD || true
65 changes: 65 additions & 0 deletions pub_tools/pub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import os
import sys

sys.path.append(os.getcwd())

from paifulogger import __version__


def build_pyproject():
if "dev" in __version__:
print("Dev version, not building.")
return None

with open("requirements.txt", "r") as f:
requirements = [f"{line.strip()}" for line in f.readlines()]

pyproject = f"""[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "PaifuLogger"
version = "{__version__}"
description = "Logging tenhou paifu into excel or html file with some key information."
readme = "README.md"
authors = [{{ name = "Jim137", email = "jim@mail.jim137.eu.org" }}]
license = {{ file = "LICENSE" }}
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
keywords = ["mahjong", "review", "logger", "paifu", "tenhou", "haifu", "paipu", "riichi-mahjong"]
dependencies = {requirements}
requires-python = ">=3.10"
[project.urls]
Homepage = "https://github.com/Jim137/Tenhou-Paifu-Logger"
[project.scripts]
log = "paifulogger.__main__:main"
plog = "paifulogger.__main__:main"
pdl = "paifulogger.paifu_dl:paifu_dl"
[tool.setuptools.packages.find]
exclude = [
"Paifu",
"牌譜",
]
[tool.setuptools.package-data]
"paifulogger.localizations" = [
"*.json",
]""".replace(
"'", '"'
)

with open("pyproject.toml", "w") as f:
f.write(pyproject)


if __name__ == "__main__":
print(__version__)
build_pyproject()

0 comments on commit 5948a8b

Please sign in to comment.