Skip to content

Commit

Permalink
Merge pull request #619 from 1nv0k32/bugfix/hatch-migration-fixes
Browse files Browse the repository at this point in the history
New versioning and fix for License
  • Loading branch information
staticdev authored Jul 17, 2023
2 parents fcd2e80 + f45d242 commit b636ac6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 37 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
labeler:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/release-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Upgrade pip
run: |
pip install --constraint=.github/workflows/constraints.txt pip
pip --version
- name: Install Hatch
run: |
pip install --constraint=.github/workflows/hatch-constraints.txt hatch
hatch --version
- name: Build package
run: |
hatch build
- name: Publish package on TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
40 changes: 6 additions & 34 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ name: Release

on:
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Check out the repository
- name: Check out the repository and set tag env
uses: actions/checkout@v3
with:
fetch-depth: 2
fetch-depth: 1
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -30,48 +31,19 @@ jobs:
pip install --constraint=.github/workflows/hatch-constraints.txt hatch
hatch --version
- name: Check if there is a parent commit
id: check-parent-commit
run: |
echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)"
- name: Detect and tag new version
id: check-version
if: steps.check-parent-commit.outputs.sha
uses: salsify/action-detect-and-tag-new-version@v2
with:
version-command: |
bash -o pipefail -c "hatch version"
- name: Bump version for developmental release
if: "! steps.check-version.outputs.tag"
run: |
version=$(hatch version) &&
hatch version $version.dev.$(date +%s)
- name: Build package
run: |
hatch build
- name: Publish package on PyPI
if: steps.check-version.outputs.tag
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

- name: Publish package on TestPyPI
if: "! steps.check-version.outputs.tag"
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/

- name: Publish the release notes
uses: release-drafter/release-drafter@v5
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
tag: ${{ env.RELEASE_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 6 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[project]
name = "human-readable"
version = "1.3.3"
dynamic = ["version"]
description = "Human Readable"
authors = [
{ name = "staticdev", email = "[email protected]"}
]
license = "MIT"
license = {text = "MIT"}
readme = "README.md"
classifiers = [
"Development Status :: 5 - Production/Stable",
Expand All @@ -17,6 +17,9 @@ classifiers = [
requires-python = ">=3.8"
dependencies = []

[tool.hatch.version]
source = "vcs"

[project.urls]
homepage = "https://github.com/staticdev/human-readable"
repository = "https://github.com/staticdev/human-readable"
Expand Down Expand Up @@ -200,5 +203,5 @@ exclude = [
]

[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

0 comments on commit b636ac6

Please sign in to comment.