Skip to content

Commit

Permalink
feat: automatic versioning (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
ds-sebastianchwilczynski committed Apr 18, 2024
1 parent 669973a commit b7ffa25
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 28 deletions.
17 changes: 0 additions & 17 deletions .bumpversion.cfg

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/check_future_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check New Version

on: workflow_dispatch

jobs:
release:
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Python Semantic Release
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
root_options: "-v --noop"
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Semantic Release

on:
workflow_dispatch:
inputs:
releaseType:
description: "version update type"
required: true
type: choice
default: "automatic"
options:
- "automatic"
- "major"
- "minor"
- "patch"

jobs:
release:
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write
contents: write

environment:
name: pypi
url: https://pypi.org/p/dbally

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Python Semantic Release Manual
id: release_manual
if: ${{ github.event.inputs.releaseType != 'automatic' }}
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: ${{ github.event.inputs.releaseType }}

- name: Python Semantic Release Automatic
id: release_automatic
if: ${{ github.event.inputs.releaseType == 'automatic' }}
uses: python-semantic-release/python-semantic-release@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

if: steps.release_manual.outputs.released == 'true' || steps.release_automatic.outputs.released == 'true'
3 changes: 0 additions & 3 deletions bump_version.sh

This file was deleted.

61 changes: 60 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,63 @@ min-similarity-lines=10
exclude_dirs = ["venv",]
# B101 disables errors for asserts in the code
# remember to not use asserts for security and control flows
skips = ["B101"]
skips = ["B101"]


[tool.semantic_release]
assets = []
commit_message = "{version}\n\nAutomatically generated by python-semantic-release"
commit_parser = "angular"
logging_use_named_masks = false
major_on_zero = false
allow_zero_version = true
tag_format = "v{version}"
version_variables = [
"setup.cfg:version",
"src/dbally/__version__.py:__version__",
]
build_command = "pip install build && python -m build"

[tool.semantic_release.branches.main]
match = "(main|master)"
prerelease_token = "rc"
prerelease = false

[tool.semantic_release.changelog]
template_dir = "templates"
changelog_file = "CHANGELOG.md"
exclude_commit_patterns = []

[tool.semantic_release.changelog.environment]
block_start_string = "{%"
block_end_string = "%}"
variable_start_string = "{{"
variable_end_string = "}}"
comment_start_string = "{#"
comment_end_string = "#}"
trim_blocks = false
lstrip_blocks = false
newline_sequence = "\n"
keep_trailing_newline = false
extensions = []
autoescape = true

[tool.semantic_release.commit_author]
env = "GIT_COMMIT_AUTHOR"
default = "semantic-release <semantic-release>"

[tool.semantic_release.commit_parser_options]
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
minor_tags = ["feat"]
patch_tags = ["fix", "perf"]
default_bump_level = 0

[tool.semantic_release.remote]
name = "origin"
type = "github"
ignore_token_for_push = false
insecure = false

[tool.semantic_release.publish]
dist_glob_patterns = ["dist/*"]
upload_to_vcs_release = true
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
name = dbally
# do not change version by hand: use bump_version.sh
version = file: src/dbally/VERSION
# do not change version by hand, is will be automatically updated during the release action
version = 0.0.2
description = "Efficient, consistent and secure library for querying structured data with natural language"
author = deepsense.ai
author_email = contact@deepsense.ai
Expand Down
1 change: 0 additions & 1 deletion src/dbally/VERSION

This file was deleted.

5 changes: 1 addition & 4 deletions src/dbally/__version__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
"""Version information."""
from pathlib import Path

version_file = Path(__file__).absolute().parents[0] / "VERSION"
__version__ = version_file.read_text(encoding="utf-8").strip()
__version__ = "0.0.2"

0 comments on commit b7ffa25

Please sign in to comment.