From 7759f1a907e5cdf1772df927282ab05d95c3ff48 Mon Sep 17 00:00:00 2001 From: BalconyJH Date: Mon, 13 Jan 2025 22:59:17 +0800 Subject: [PATCH] :construction_worker: Update release workflow --- .github/workflows/release.yml | 56 ++++++++++++++++++++++++++----- README.md | 2 +- docs/topics/Installation-guide.md | 3 +- pyproject.toml | 15 ++++++--- 4 files changed, 62 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4cf0cec..b3fa47a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,28 +1,68 @@ name: Release on: + workflow_dispatch: + inputs: + version: + description: "Version to release (e.g., v1.0.0)" + required: true + default: "" + push: tags: - v* jobs: pypi-publish: - name: upload release to PyPI + name: Upload release to PyPI runs-on: ubuntu-latest permissions: contents: write id-token: write steps: - - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - - uses: pdm-project/setup-pdm@v3 + - name: Setup PDM + uses: pdm-project/setup-pdm@v4.2 + with: + python-version: 3.9 - - name: Publish package distributions to PyPI - run: pdm publish + - name: Prepare pdm environment + run: pdm show --version - name: Get Version id: version run: | - echo "VERSION=$(poetry version -s)" >> $GITHUB_OUTPUT - echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT - echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT \ No newline at end of file + INPUT_VERSION="${{ github.event.inputs.version }}" + TAG_VERSION=${{ github.ref_name || '' }} + VERSION=$(pdm show --version) + + echo "Debug - Parsed VERSION: $VERSION" + echo "Debug - INPUT_VERSION: $INPUT_VERSION" + echo "Debug - TAG_VERSION: $TAG_VERSION" + + if [ -n "$INPUT_VERSION" ]; then + echo "VERSION=$INPUT_VERSION" >> $GITHUB_OUTPUT + echo "TAG_VERSION=${INPUT_VERSION#v}" >> $GITHUB_OUTPUT + else + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "TAG_VERSION=${TAG_VERSION#v}" >> $GITHUB_OUTPUT + fi + + - name: Check Version + if: ${{ steps.version.outputs.VERSION != steps.version.outputs.TAG_VERSION }} + run: exit 1 + + - name: Build distribution files + run: pdm build + + - name: Publish package distributions to PyPI + run: pdm publish + + - name: Publish package to GitHub + run: | + gh release upload --clobber ${{ steps.version.outputs.TAG_NAME }} dist/*.tar.gz dist/*.whl + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + diff --git a/README.md b/README.md index fa88daa..f273522 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ pip install aioarxiv * Python 3.9 or higher ## License -[MIT License (c) 2024 BalconyJH ](LICENSE) +[MIT License (c) 2025 BalconyJH ](LICENSE) ## Links * Documentation for aioarxiv is WIP diff --git a/docs/topics/Installation-guide.md b/docs/topics/Installation-guide.md index 6c4b3a8..8aa3ecf 100644 --- a/docs/topics/Installation-guide.md +++ b/docs/topics/Installation-guide.md @@ -34,7 +34,8 @@ at this time: | **Version** | **Build** | **Release Date** | **Status** | **Notes** | |-------------|--------------|------------------|------------|-----------------------| -| 0.1.2 | PyPI Release | 15/11/2024 | Latest | Initial testing phase | +| 0.2.0 | PyPI Release | 13/1/2025 | Latest | Initial testing phase | +| 0.1.2 | PyPI Release | 15/11/2024 | Old | Initial testing phase | ## System requirements diff --git a/pyproject.toml b/pyproject.toml index 7adf7bc..4314dee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,6 +30,7 @@ line-length = 88 target-version = "py39" [tool.ruff.lint] +exclude = ["typings/*/"] select = [ "F", # Pyflakes "W", # pycodestyle warnings @@ -37,28 +38,34 @@ select = [ "I", # isort "UP", # pyupgrade "ASYNC", # flake8-async + "B", # flake8-bugbear "C4", # flake8-comprehensions + "DTZ", # flake8-datetimez "T10", # flake8-debugger "T20", # flake8-print "PYI", # flake8-pyi "PT", # flake8-pytest-style "Q", # flake8-quotes + "SIM", # flake8-simplify "TID", # flake8-tidy-imports + "PLE", # Pylint errors + "NPY", # NumPy-specific rules "RUF", # Ruff-specific rules - "DTZ", # flake8-datetimez - "SIM", # flake8-simplify - "ISC", # flake8-implicit-str-concat ] ignore = [ "E402", # module-import-not-at-top-of-file - "UP037", # quoted-annotation + "B008", # function-call-in-default-argument "RUF001", # ambiguous-unicode-character-string "RUF002", # ambiguous-unicode-character-docstring "RUF003", # ambiguous-unicode-character-comment "ISC001" # single-line-implicit-string-concatenation ] +[tool.ruff.format] +line-ending = "lf" + [tool.ruff.lint.isort] +length-sort = false force-sort-within-sections = true known-first-party = ["aioarxiv", "tests/*"] extra-standard-library = ["typing_extensions"]