从发布标签添加版本以使用 github 操作进行构建

问题描述 投票:0回答:1

伙计们,我正在尝试发布我的包,但每次它在构建阶段都会失败,因为它试图引用我发布用于测试的 0.1.0 并删除它们。

setup.py
中,我已将版本更新为 0.1.1,但每当我创建新版本时,它仍然构建为 0.1.0。

如何将我正在使用的发布标签添加到 .yml 文件中。

这是.yml文件的结构

name: Upload Python Package

on:
  release:
    types: [published]

permissions:
  contents: read

jobs:
  deploy:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.x'
    - name: Check that tag version matches code version
      run: |
          tag=${GITHUB_REF#refs/tags/}
          version=$(python setup.py --version)
          echo 'tag='$tag
          echo "version file="$version
          test "$tag" == "$version"
    
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install build
    - name: Build package
      run: python -m build

setup.py的内容

from setuptools import find_packages, setup

# from sphinx.setup_command import BuildDoc

with open("README.md", "r", encoding="utf-8") as fh:
    long_description = fh.read()

setup(
    name="arxiv-summarizer",
    version="0.1.1",
    description="A happy toolkit for arxiv paper summarization and understanding.",
    long_description=long_description,
    long_description_content_type="text/markdown",
    url="https://github.com/ArchanGhosh/Arxiv-Summarizer",
    project_urls={
        "GitHub": "https://github.com/ArchanGhosh/Arxiv-Summarizer",
        "Homepage": "https://github.com/ArchanGhosh/Arxiv-Summarizer",
    },
    author="",
    author_email="",
    maintainer="",
    maintainer_email="",
    keywords="",
    license="Apache",
    package_dir={"": "src"},
    packages=find_packages(where="src"),
    include_package_data=True,
    py_modules=['__main__'],
    entry_points={
        'console_scripts': [
            'arxiv_summarizer = arxiv_summarizer.__main__:cli',
        ],
    },
    # cmdclass={"build_sphinx": BuildDoc},
    # these are optional and override conf.py settings
    command_options={
        "build_sphinx": {
            "project": ("setup.py", ""),
            "version": ("setup.py", "0.1.1a"),
            "release": ("setup.py", "0.1"),
            "source_dir": ("setup.py", "docs"),
        }
    },
    install_requires=[
        # Arxiv & PDF
        "langchain",    # For loading Arxiv PDFs
        "arxiv",        # `langchain` dependency
        "pymupdf",      # `langchain` dependency

        # ML
        "transformers", # For Transformer models
        #"gradio",       # For Web Interface
        "torch==2.1.2", # For Machine Learning

        # CLI
        "click",        # For CLI arguments
        "rich",         # For Rich Text in CLI

        # Tests
        "pytest",       # For Unit Tests
    ],
    extras_require={
        "dev": [
            "nox",
            "pytest",
        ],
        "docs": [
            "sphinx",
            "sphinxemoji",
            "pydata-sphinx-theme",
            "numpydoc",
            "sphinx_panels",
            "matplotlib",
            "Ipython",
            "sphinx-hoverxref",
        ],
    },
    classifiers=[
        # License
        "License :: OSI Approved :: Apache Software License",
        # Project Maturity
        "Development Status :: 3 - Alpha",
        # Topic
        "Topic :: Communications",
        # Intended Audience
        "Intended Audience :: Science/Research",
        # Compatibility
        "Operating System :: Microsoft :: Windows",
        "Operating System :: MacOS",
        "Operating System :: POSIX :: Linux",
        #Environment
        "Environment :: Console",
        "Environment :: GPU",
        
        # Python Version
        #"Programming Language :: Python :: 3",
        #"Programming Language :: Python :: 3.4",
        #"Programming Language :: Python :: 3.5",
        #"Programming Language :: Python :: 3.6",
        #"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",
    ],
)

build error log 获取新的版本 ID 来代替旧的版本 ID。

python package github-actions pypi
1个回答
0
投票

发布中的标签必须在要附加到该发布中的最终提交之后创建。

我们的错误是发布标签是在最终发布提交之前一小时创建的,这没有考虑到最后几次提交。

© www.soinside.com 2019 - 2024. All rights reserved.