From b6eb1d6a7bf3e27b20a0d194f950912b903eae6b Mon Sep 17 00:00:00 2001 From: duyifan Date: Fri, 12 Dec 2025 17:17:52 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20action=20for=20au?= =?UTF-8?q?to=20release=20and=20pypi-update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/python-test.yml | 2 +- .github/workflows/release-build.yml | 38 +++++++++++++++++++++++ .github/workflows/release-draft.yml | 18 +++++++++++ .github/workflows/release-pypi-upload.yml | 24 ++++++++++++++ pyproject.toml | 7 +++-- 5 files changed, 86 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release-build.yml create mode 100644 .github/workflows/release-draft.yml create mode 100644 .github/workflows/release-pypi-upload.yml diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index cf45adc6..a9e8a0d4 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -1,7 +1,7 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python application +name: Pytest on: push: diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100644 index 00000000..44d6db10 --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,38 @@ +name: Build and Commit Artifacts + +on: + push: + branches: [ "release/*" ] + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + permissions: + # Give the default GITHUB_TOKEN write permission to commit and push the + # added or changed files to the repository. + contents: write + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: commit build artifacts + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "build: add distribution files" + file_pattern: "dist/*" + add_options: "-f" + disable_globbing: false + skip_dirty_check: true diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml new file mode 100644 index 00000000..21e31338 --- /dev/null +++ b/.github/workflows/release-draft.yml @@ -0,0 +1,18 @@ +name: Release Draft 🚀 +on: + push: + tags: + - 'v*' + +jobs: + publishGitRelease: + if: startsWith(github.event.base_ref, 'refs/heads/release') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: dist/* + draft: true + fail_on_unmatched_files: true diff --git a/.github/workflows/release-pypi-upload.yml b/.github/workflows/release-pypi-upload.yml new file mode 100644 index 00000000..ec75bcba --- /dev/null +++ b/.github/workflows/release-pypi-upload.yml @@ -0,0 +1,24 @@ +name: Publish Python 🐍 distribution 📦 to PyPI +on: + release: + types: + - published + +jobs: + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.ac.cn/p/basicts # Replace with your PyPI project name + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - uses: actions/checkout@v4 + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true diff --git a/pyproject.toml b/pyproject.toml index 5a8d30ff..c9454733 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,6 @@ requires = ["setuptools>=45", "wheel"] [project] name = "BasicTS" -version = "1.0.2" description = "A Fair and Scalable Time Series Analysis Toolkit and benchmark." readme = "README.md" requires-python = ">=3.9" @@ -24,10 +23,14 @@ dependencies = [ "tensorboard==2.18.0", "transformers==4.40.1" ] +dynamic = ["version"] [project.urls] Homepage = "https://github.com/GestaltCogTeam/BasicTS" Repository = "https://github.com/GestaltCogTeam/BasicTS" [tool.setuptools] -package-dir = {"" = "src"} \ No newline at end of file +package-dir = {"" = "src"} + +[tool.setuptools.dynamic] +version = {attr = "basicts.__version__"}