Skip to content

Commit

Permalink
feat: initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
kmnhan committed Aug 15, 2024
0 parents commit 8adf678
Show file tree
Hide file tree
Showing 7 changed files with 439 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Release

on:
push:
branches: [ "main" ]
env:
FORCE_COLOR: 1

jobs:
release:
runs-on: ubuntu-latest
concurrency:
group: release
environment:
name: pypi
url: https://pypi.org/p/cz-changeup
permissions:
id-token: write
contents: write

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

- name: Run commitizen
if: ${{ !startsWith(github.event.head_commit.message, 'bump:') }}
id: cz
uses: commitizen-tools/commitizen-action@master
with:
extra_requirements : "."
github_token: ${{ secrets.GITHUB_TOKEN }}
changelog_increment_filename: body.md

- name: Build package distributions
id: build
if: env.REVISION != env.PREVIOUS_REVISION
run: |
pipx run build
- name: Publish package distributions to PyPI
id: pypi-publish
if: env.REVISION != env.PREVIOUS_REVISION
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true

- name: Publish package distributions to GitHub Releases
id: github-release
if: env.REVISION != env.PREVIOUS_REVISION
uses: softprops/action-gh-release@v2
with:
body_path: "body.md"
tag_name: v${{ steps.cz.outputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
227 changes: 227 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk
Expand Down
50 changes: 50 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
ci:
autoupdate_commit_msg: "ci(pre-commit): pre-commit autoupdate"
autofix_commit_msg: "style: pre-commit auto fixes [...]"
autoupdate_schedule: monthly

default_install_hook_types: [pre-commit, commit-msg]

repos:

# Meta hooks
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes

# Security & credential scanning/alerting
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
- id: check-merge-conflict
- id: check-toml
- id: check-vcs-permalinks
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

# Lint and format with ruff
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.6
hooks:
# Run the linter.
- id: ruff
args: [ --fix ]
# Run the formatter.
- id: ruff-format

# # Commitizen
# - repo: https://github.com/commitizen-tools/commitizen
# rev: v3.28.0
# hooks:
# - id: commitizen
# - id: commitizen-branch
# stages: [push]
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# cz-changeup

This plugin is a version of
[Commitizen](https://commitizen-tools.github.io/commitizen/)'s default conventional
style with a more informative changelog format.

## Installation

```bash
pip install cz-changeup
```

## Configuration

Add to your `pyproject.toml`:

```toml
[tool.commitizen]
name = "cz_changeup"
```

The behavior of the plugin can be customized by providing the following options under `tool.commitizen`:

| Option | Description | Default | Example |
| ------------------------ | ----------------------------------------------------------------------------------------------------- | ------- | ------------------------------ |
| `changeup_repo_base_url` | The base URL for the repository. If given, adds a link to the commit for each entry in the changelog. | `""` | `"https://github.com/my/repo"` |
| `changeup_show_body` | Whether to include the commit body in the changelog. | `true` | |
| `changeup_body_indent` | The number of spaces to indent the commit body if `show_body` is set to `true`. | `2` | |
Loading

0 comments on commit 8adf678

Please sign in to comment.