Skip to content

Commit

Permalink
Dynamic version, release preparation (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
kokorin authored Jul 7, 2024
1 parent 391a4b0 commit 60c33fb
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 3 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Release

on:
push:
branches:
- release/**
tags:
- v*
env:
PIP_CACHE_DIR: .cache/pip
PRE_COMMIT_HOME: .cache/pre-commit
HATCH_CACHE_DIR: .cache/hatch

HATCH_INDEX_USER: __token__
HATCH_INDEX_REPO: main
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
jobs:
test-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.12
cache: pip
- run: pip install hatch
- run: hatch version
- run: hatch build
- run: hatch publish
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Test Publish
name: Test Release

on:
push:
branches:
- main
- release/**
env:
PIP_CACHE_DIR: .cache/pip
PRE_COMMIT_HOME: .cache/pre-commit
Expand All @@ -22,5 +23,6 @@ jobs:
python-version: 3.12
cache: pip
- run: pip install hatch
- run: hatch version
- run: hatch build
- run: hatch publish
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- release/**
pull_request:
types:
- opened
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ __pycache__
/.vscode
/.idea
/dist

#auto-generated
/dbt_pumpkin/version.py
1 change: 1 addition & 0 deletions dbt_pumpkin/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def set_up_logging(debug):


@click.group
@click.version_option()
def cli():
pass

Expand Down
17 changes: 15 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[project]
name = "dbt-pumpkin"
version = "0.1.0"
description = ""
authors = [
{name = "Denis Kokorin", email = "[email protected]"}
Expand All @@ -12,6 +11,7 @@ dependencies = [
"ruamel-yaml>=0.17",
"click>=8.1.0"
]
dynamic = ["version"]

[project.urls]
"Source code" = "https://github.com/kokorin/dbt-pumpkin"
Expand All @@ -21,13 +21,20 @@ dbt-pumpkin = "dbt_pumpkin.cli:main"

[tool.hatch]

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

[tool.hatch.build]
exclude = [
"/.github",
"/tests",
"/.pre-commit-config.yaml",
"/.gitignore"
]
artifacts = ["dbt_pumpkin/version.py"]

[tool.hatch.build.hooks.version]
path = "dbt_pumpkin/version.py"

[tool.hatch.envs.default]
dependencies = [
Expand Down Expand Up @@ -63,6 +70,12 @@ dbt = ["1.5", "1.6", "1.7", "1.8"]
python = ["3.12"]
dbt = ["1.7", "1.8"]

[tool.versioningit]

[tool.versioningit.vcs]
method = "git"
default-tag = "v0.0.0"

[tool.ruff]
# cache directory for GH actions
extend-exclude = [".cache"]
Expand All @@ -81,5 +94,5 @@ filterwarnings = [
]

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

0 comments on commit 60c33fb

Please sign in to comment.