Skip to content

Commit e8b21ea

Browse files
committed
Refactor release workflow
1 parent 451f2e8 commit e8b21ea

File tree

5 files changed

+53
-24
lines changed

5 files changed

+53
-24
lines changed

.github/workflows/constraints.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
pip==23.2
2-
virtualenv==20.17.1
1+
pip==24.3.1
2+
virtualenv==20.29.1
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
hatch==1.14.0

.github/workflows/release-dev.yml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: Release Dev
3+
4+
"on":
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
release:
11+
if: github.repository_owner == 'PyCQA'
12+
name: Release
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Check out the repository
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 2
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.13"
24+
25+
- name: Install UV
26+
uses: astral-sh/setup-uv@v5
27+
28+
- name: Build package
29+
run: |
30+
uv build

.github/workflows/release.yml

+12-20
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ name: Release
33

44
"on":
55
push:
6-
branches:
7-
- main
6+
tags:
7+
- "v[0-9]+.[0-9]+.[0-9]+"
88

99
jobs:
1010
release:
@@ -17,16 +17,24 @@ jobs:
1717
with:
1818
fetch-depth: 2
1919

20+
- name: Set Tag env
21+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
22+
2023
- name: Set up Python
2124
uses: actions/setup-python@v5
2225
with:
23-
python-version: "3.12"
26+
python-version: "3.13"
2427

2528
- name: Upgrade pip
2629
run: |
2730
pip install --constraint=.github/workflows/constraints.txt pip
2831
pip --version
2932
33+
- name: Install Hatch
34+
run: |
35+
pip install --constraint=.github/workflows/hatch-constraints.txt hatch
36+
hatch --version
37+
3038
- name: Install UV
3139
uses: astral-sh/setup-uv@v5
3240

@@ -35,25 +43,9 @@ jobs:
3543
run: |
3644
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
3745
38-
- name: Detect and tag new version
39-
id: check-version
40-
if: steps.check-parent-commit.outputs.sha
41-
uses: salsify/action-detect-and-tag-new-version@v2
42-
with:
43-
tag-template: "{VERSION}"
44-
version-command: |
45-
bash -o pipefail -c "poetry version | awk '{ print \$2 }'"
46-
47-
- name: Bump version for developmental release
48-
if: "! steps.check-version.outputs.tag"
49-
run: |
50-
poetry version patch &&
51-
version=$(poetry version | awk '{ print $2 }') &&
52-
poetry version $version.dev.$(date +%s)
53-
5446
- name: Build package
5547
run: |
56-
poetry build --ansi
48+
uv build
5749
5850
- name: Publish package on PyPI
5951
if: steps.check-version.outputs.tag

pyproject.toml

+8-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ line-length = 100
33

44
[project]
55
name = "isort"
6-
version = "5.13.2"
6+
dynamic = ["version"]
77
description = "A Python utility / library to sort Python imports."
88
authors = [{name = "Timothy Crosley", email = "timothy.crosley@gmail.com"}, {name = "staticdev", email = "staticdev-support@proton.me"}]
99
license = "MIT"
@@ -42,6 +42,12 @@ requires-python = ">=3.9.0"
4242

4343
dependencies = []
4444

45+
[tool.hatch.version]
46+
source = "vcs"
47+
48+
[tool.hatch.version.raw-options]
49+
local_scheme = "no-local-version"
50+
4551
[project.scripts]
4652
isort = "isort.main:main"
4753
isort-identify-imports = "isort.main:identify_imports_main"
@@ -132,7 +138,7 @@ logo = "art/logo.png"
132138
palette = {scheme = "isort"}
133139

134140
[build-system]
135-
requires = ["hatchling"]
141+
requires = ["hatchling", "hatch-vcs"]
136142
build-backend = "hatchling.build"
137143

138144
[tool.mypy]

0 commit comments

Comments
 (0)