Skip to content

Commit b636ac6

Browse files
authored
Merge pull request #619 from 1nv0k32/bugfix/hatch-migration-fixes
New versioning and fix for License
2 parents fcd2e80 + f45d242 commit b636ac6

File tree

4 files changed

+56
-37
lines changed

4 files changed

+56
-37
lines changed

.github/workflows/labeler.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
branches:
66
- main
7+
tags:
8+
- "v[0-9]+.[0-9]+.[0-9]+"
79

810
jobs:
911
labeler:

.github/workflows/release-dev.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Check out the repository
14+
uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 1
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.11"
22+
23+
- name: Upgrade pip
24+
run: |
25+
pip install --constraint=.github/workflows/constraints.txt pip
26+
pip --version
27+
28+
- name: Install Hatch
29+
run: |
30+
pip install --constraint=.github/workflows/hatch-constraints.txt hatch
31+
hatch --version
32+
33+
- name: Build package
34+
run: |
35+
hatch build
36+
37+
- name: Publish package on TestPyPI
38+
uses: pypa/gh-action-pypi-publish@release/v1
39+
with:
40+
user: __token__
41+
password: ${{ secrets.TEST_PYPI_TOKEN }}
42+
repository_url: https://test.pypi.org/legacy/

.github/workflows/release.yml

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ name: Release
22

33
on:
44
push:
5-
branches:
6-
- main
5+
tags:
6+
- "v[0-9]+.[0-9]+.[0-9]+"
77

88
jobs:
99
release:
1010
name: Release
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Check out the repository
13+
- name: Check out the repository and set tag env
1414
uses: actions/checkout@v3
1515
with:
16-
fetch-depth: 2
16+
fetch-depth: 1
17+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
1718

1819
- name: Set up Python
1920
uses: actions/setup-python@v4
@@ -30,48 +31,19 @@ jobs:
3031
pip install --constraint=.github/workflows/hatch-constraints.txt hatch
3132
hatch --version
3233
33-
- name: Check if there is a parent commit
34-
id: check-parent-commit
35-
run: |
36-
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
37-
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-
version-command: |
44-
bash -o pipefail -c "hatch version"
45-
46-
- name: Bump version for developmental release
47-
if: "! steps.check-version.outputs.tag"
48-
run: |
49-
version=$(hatch version) &&
50-
hatch version $version.dev.$(date +%s)
51-
5234
- name: Build package
5335
run: |
5436
hatch build
5537
5638
- name: Publish package on PyPI
57-
if: steps.check-version.outputs.tag
5839
uses: pypa/gh-action-pypi-publish@release/v1
5940
with:
6041
user: __token__
6142
password: ${{ secrets.PYPI_TOKEN }}
6243

63-
- name: Publish package on TestPyPI
64-
if: "! steps.check-version.outputs.tag"
65-
uses: pypa/gh-action-pypi-publish@release/v1
66-
with:
67-
user: __token__
68-
password: ${{ secrets.TEST_PYPI_TOKEN }}
69-
repository_url: https://test.pypi.org/legacy/
70-
7144
- name: Publish the release notes
7245
uses: release-drafter/release-drafter@v5
7346
with:
74-
publish: ${{ steps.check-version.outputs.tag != '' }}
75-
tag: ${{ steps.check-version.outputs.tag }}
47+
tag: ${{ env.RELEASE_VERSION }}
7648
env:
7749
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pyproject.toml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[project]
22
name = "human-readable"
3-
version = "1.3.3"
3+
dynamic = ["version"]
44
description = "Human Readable"
55
authors = [
66
{ name = "staticdev", email = "[email protected]"}
77
]
8-
license = "MIT"
8+
license = {text = "MIT"}
99
readme = "README.md"
1010
classifiers = [
1111
"Development Status :: 5 - Production/Stable",
@@ -17,6 +17,9 @@ classifiers = [
1717
requires-python = ">=3.8"
1818
dependencies = []
1919

20+
[tool.hatch.version]
21+
source = "vcs"
22+
2023
[project.urls]
2124
homepage = "https://github.com/staticdev/human-readable"
2225
repository = "https://github.com/staticdev/human-readable"
@@ -200,5 +203,5 @@ exclude = [
200203
]
201204

202205
[build-system]
203-
requires = ["hatchling"]
206+
requires = ["hatchling", "hatch-vcs"]
204207
build-backend = "hatchling.build"

0 commit comments

Comments
 (0)