From d88f3982ad3963647b3f10c93321dd90ae2477ab Mon Sep 17 00:00:00 2001
From: tanzhijian <i@tanzhijian.org>
Date: Wed, 17 Jan 2024 19:29:52 +0800
Subject: [PATCH] publish

---
 .github/workflows/publish.yml    | 14 +++++++++++++
 .github/workflows/test-suite.yml | 36 ++++++++++++++++++++++++++++++++
 fifacodes/__init__.py            |  2 ++
 fifacodes/py.typed               |  0
 pyproject.toml                   |  4 ++--
 5 files changed, 54 insertions(+), 2 deletions(-)
 create mode 100644 .github/workflows/publish.yml
 create mode 100644 .github/workflows/test-suite.yml
 create mode 100644 fifacodes/py.typed

diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..1414be6
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,14 @@
+name: Python package
+on:
+  push:
+    tags:
+      - '*'
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v4
+      - name: Build and publish to pypi
+        uses: JRubics/poetry-publish@v1.17
+        with:
+          pypi_token: ${{ secrets.PYPI_TOKEN }}
diff --git a/.github/workflows/test-suite.yml b/.github/workflows/test-suite.yml
new file mode 100644
index 0000000..0ca4877
--- /dev/null
+++ b/.github/workflows/test-suite.yml
@@ -0,0 +1,36 @@
+name: Test Suite
+
+on:
+  push:
+    branches: ["main"]
+  pull_request:
+    branches: ["main"]
+
+jobs:
+  tests:
+    name: "Python ${{ matrix.python-version }}"
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        python: ["3.10", "3.11", "3.12"]
+
+    steps:
+    - uses: actions/checkout@v4
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v4
+      with:
+        python-version: ${{ matrix.python }}
+    - name: Install poetry and dependencies
+      run: |
+        pip install poetry
+        poetry add setuptools@latest
+        poetry install
+    - name: Lint with Ruff
+      run: |
+        poetry run ruff .
+    - name: Type Check with Mypy
+      run: |
+        poetry run mypy .
+    - name: Test with pytest
+      run: |
+        poetry run pytest
diff --git a/fifacodes/__init__.py b/fifacodes/__init__.py
index d419259..534533c 100644
--- a/fifacodes/__init__.py
+++ b/fifacodes/__init__.py
@@ -5,6 +5,8 @@
 
 from rapidfuzz import process
 
+__version__ = "0.1.0"
+
 _DATA_PATH = Path(__file__).parent
 _DEFAULT_DATA_PATH = _DATA_PATH / "default.csv"
 _CUSTOM_DATA_PATH = _DATA_PATH / "custom.csv"
diff --git a/fifacodes/py.typed b/fifacodes/py.typed
new file mode 100644
index 0000000..e69de29
diff --git a/pyproject.toml b/pyproject.toml
index af317eb..4f59ab6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [tool.poetry]
 name = "fifacodes"
-version = "0.0.1"
+version = "0.1.0"
 description = "FIFA country codes query and search."
 authors = ["tanzhijian <tanzhijianorg@outlook.com>"]
 license = "MIT"
@@ -10,7 +10,7 @@ homepage = "https://github.com/tanzhijian/fifacodes"
 repository = "https://github.com/tanzhijian/fifacodes"
 
 [tool.poetry.dependencies]
-python = "^3.12"
+python = ">=3.10"
 rapidfuzz = "^3.6.1"