Skip to content

Commit

Permalink
Merge pull request #1 from DVDAGames/feature/publishing
Browse files Browse the repository at this point in the history
chore: try to configure publishing workflow
  • Loading branch information
ericrallen authored Jan 24, 2025
2 parents acf3c2c + a87f305 commit 848543b
Show file tree
Hide file tree
Showing 6 changed files with 736 additions and 17 deletions.
8 changes: 8 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# These are supported funding model platforms

github: [ericrallen]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: ericrallen
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
custom: https://supporters.eff.org/donate/
58 changes: 58 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# adapted from:
# https://til.simonwillison.net/pypi/pypi-releases-from-github
# https://github.com/snok/install-poetry
# https://jacobian.org/til/github-actions-poetry/
# https://github.com/orgs/community/discussions/25305#discussioncomment-8256560

name: Publish to PyPI

on:
push:
branches:
- main
tags-ignore:
- "**"

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
environment: pypi

steps:
- uses: actions/checkout@v4

- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v5
with:
python-version: "3.10"

- name: build release distributions
run: |
uv build
- name: upload windows dists
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
needs:
- build
permissions:
id-token: write

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f
49 changes: 49 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# adapted from:
# https://til.simonwillison.net/pypi/pypi-releases-from-github
# https://github.com/snok/install-poetry
# https://jacobian.org/til/github-actions-poetry/
# https://github.com/orgs/community/discussions/25305#discussioncomment-8256560

name: Release Version

on:
push:
branches:
- main
tags-ignore:
- "**"

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
release:
runs-on: ubuntu-latest
environment: package
concurrency: release

permissions:
id-token: write
contents: write

steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.RELEASE_VERSION_BUMP_APP_ID }}
private-key: ${{ secrets.RELEASE_VERSION_BUMP_PRIVATE_KEY }}

- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}

- run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Python Semantic Release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ steps.app-token.outputs.token }}
37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# adapted from:
# https://til.simonwillison.net/pypi/pypi-releases-from-github
# https://github.com/snok/install-poetry
# https://jacobian.org/til/github-actions-poetry/
name: Run Tests

on:
workflow_dispatch:
pull_request:
branches:
- main

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4

- name: Install the latest version of uv and set the python version
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
python-version: ${{ matrix.python-version }}

- name: Install lint dependencies
run: |
uv sync --group test
- name: Test with python ${{ matrix.python-version }}
run: uv run --frozen pytest
11 changes: 5 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
[project]
name = "pgn-tokenizer"
version = "0.1.0"
version = "1.0.0"
description = "A byte pair encoding tokenizer for chess portable game notation (PGN)"
readme = "README.md"
authors = [
{ name = "Eric allen", email = "eric@ericrallen.dev" }
]
requires-python = ">=3.13"
requires-python = ">=3.10"
dependencies = [
"transformers>=4.48.1",
]

[project.scripts]
pgn-tokenizer = "pgn_tokenizer:main"

[project.optional-dependencies]
test = [
"pytest>=8.3.4",
]

[build-system]
requires = ["hatchling"]
Expand All @@ -34,3 +30,6 @@ dev = [
"ruff>=0.9.3",
"tokenizers>=0.21.0",
]
test = [
"pytest>=8.3.4",
]
Loading

0 comments on commit 848543b

Please sign in to comment.