Skip to content

Commit 3bc7b3a

Browse files
authored
chore: 🤖 add action for auto release and pypi-update (#304)
1 parent 2b90d59 commit 3bc7b3a

File tree

5 files changed

+86
-3
lines changed

5 files changed

+86
-3
lines changed

.github/workflows/python-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a single version of Python
22
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
33

4-
name: Python application
4+
name: Pytest
55

66
on:
77
push:
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and Commit Artifacts
2+
3+
on:
4+
push:
5+
branches: [ "release/*" ]
6+
7+
jobs:
8+
build:
9+
name: Build distribution 📦
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
# Give the default GITHUB_TOKEN write permission to commit and push the
14+
# added or changed files to the repository.
15+
contents: write
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.x"
23+
- name: Install pypa/build
24+
run: >-
25+
python3 -m
26+
pip install
27+
build
28+
--user
29+
- name: Build a binary wheel and a source tarball
30+
run: python3 -m build
31+
- name: commit build artifacts
32+
uses: stefanzweifel/git-auto-commit-action@v4
33+
with:
34+
commit_message: "build: add distribution files"
35+
file_pattern: "dist/*"
36+
add_options: "-f"
37+
disable_globbing: false
38+
skip_dirty_check: true
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release Draft 🚀
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
7+
jobs:
8+
publishGitRelease:
9+
if: startsWith(github.event.base_ref, 'refs/heads/release')
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Release
14+
uses: softprops/action-gh-release@v1
15+
with:
16+
files: dist/*
17+
draft: true
18+
fail_on_unmatched_files: true
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI
2+
on:
3+
release:
4+
types:
5+
- published
6+
7+
jobs:
8+
publish-to-pypi:
9+
name: >-
10+
Publish Python 🐍 distribution 📦 to PyPI
11+
12+
runs-on: ubuntu-latest
13+
environment:
14+
name: pypi
15+
url: https://pypi.ac.cn/p/basicts # Replace <package-name> with your PyPI project name
16+
permissions:
17+
id-token: write # IMPORTANT: mandatory for trusted publishing
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Publish distribution 📦 to PyPI
22+
uses: pypa/gh-action-pypi-publish@release/v1
23+
with:
24+
verbose: true

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ requires = ["setuptools>=45", "wheel"]
33

44
[project]
55
name = "BasicTS"
6-
version = "1.0.2"
76
description = "A Fair and Scalable Time Series Analysis Toolkit and benchmark."
87
readme = "README.md"
98
requires-python = ">=3.9"
@@ -24,10 +23,14 @@ dependencies = [
2423
"tensorboard==2.18.0",
2524
"transformers==4.40.1"
2625
]
26+
dynamic = ["version"]
2727

2828
[project.urls]
2929
Homepage = "https://github.com/GestaltCogTeam/BasicTS"
3030
Repository = "https://github.com/GestaltCogTeam/BasicTS"
3131

3232
[tool.setuptools]
33-
package-dir = {"" = "src"}
33+
package-dir = {"" = "src"}
34+
35+
[tool.setuptools.dynamic]
36+
version = {attr = "basicts.__version__"}

0 commit comments

Comments
 (0)