Skip to content

Commit

Permalink
Add pypi build and better version support
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrt committed Feb 18, 2024
1 parent c50adfd commit 3fd6a9f
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
32 changes: 31 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
# Builds the Dockerfile and pushes it to dockerhub
release:
docker-release:
name: Release - Docker image
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -36,3 +36,33 @@ jobs:
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
pypi-release:
name: Release - PyPi Package
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/palworld-exporter
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[project]
name = "palworld-exporter"
version = "1.0.0"
version = "1.3.1"
description = "Prometheus exporter for Palword Server"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.9"

license = { file = "LICENSE" }
keywords = ["palworld", "prometheus", "exporter"]
Expand All @@ -28,8 +28,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",

"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
Expand Down
3 changes: 3 additions & 0 deletions src/palworld_exporter/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from get_version import get_version
__version__ = get_version(__file__)
del get_version
9 changes: 8 additions & 1 deletion src/palworld_exporter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,21 @@
@click.option('--save-directory', default=None, envvar='SAVE_DIRECTORY', help='Path to directory contain all .sav files (e.g. Pal/Saved/SaveGames)', show_default='None', type=click.Path(exists=True, dir_okay=True, file_okay=False))
@click.option('--log-level', type=LogLevel(), default='INFO', help='Set logging level', envvar='LOG_LEVEL', show_default=True)
@click.option('--ignore-logging-in', is_flag=True, default=True, envvar='IGNORE_LOGGING_IN', help='Ignore players actively logging in that temporarily have no Player UID')
@click.option('--version', is_flag=True, default=False, help='Print version of palworld-exporter and exit')
def main(rcon_host: str,
rcon_port: int,
rcon_password: str,
listen_address: str,
listen_port: int,
save_directory: str,
log_level: int,
ignore_logging_in: bool):
ignore_logging_in: bool,
version: bool):

if version:
from palworld_exporter import __version__
click.echo(__version__)
return

logging.basicConfig(format='%(asctime)s.%(msecs)03d %(levelname)-8s [%(filename)s:%(lineno)d] %(message)s',
datefmt='%Y-%m-%d:%H:%M:%S',
Expand Down
1 change: 0 additions & 1 deletion src/palworld_exporter/version.py

This file was deleted.

0 comments on commit 3fd6a9f

Please sign in to comment.