From 29b2e2b232958cd11876b20cb5fedf729422dc9f Mon Sep 17 00:00:00 2001 From: Jay Chung Date: Tue, 18 Jun 2024 22:15:00 +0800 Subject: [PATCH] CI add publish to pypi --- .github/workflows/ci.yaml | 21 ++++++++++++++++++--- pyproject.toml | 5 ++++- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3ab6ca8..7dbd3a2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -2,8 +2,8 @@ name: CI on: push: - branches: - - main + tags: + - "**" pull_request: concurrency: @@ -41,5 +41,20 @@ jobs: env: FYMAIL_GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - hatch env create test + hatch env create fymail-test hatch test + publish: + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/') + needs: test + steps: + - uses: actions/checkout@v4 + - name: Install Hatch + uses: pypa/hatch@install + - name: publish + env: + HATCH_INDEX_USER: __token__ + HATCH_INDEX_AUTH: ${{ secrets.PYPI_API_TOKEN }} + run: | + hatch build + hatch publish diff --git a/pyproject.toml b/pyproject.toml index 61a8869..5d7bc64 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ Source = "https://github.com/zhongjiajie/fymail" [tool.hatch.version] path = "src/fymail/__init__.py" -[tool.hatch.envs.test] +[tool.hatch.envs.fymail-test] extra-dependencies = [ "pytest-asyncio", ] @@ -68,6 +68,9 @@ preview = true [tool.ruff.lint.extend-per-file-ignores] "examples/*" = ["INP001"] +[tool.ruff.lint.isort] +known-first-party = ["fymail"] + [tool.hatch.build.targets.sdist] exclude = [ "/.github",