diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..d402214 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,43 @@ +when: + - event: push + branch: main + +steps: + - name: release + image: alpine:latest + # Skip if this is a version bump commit (prevents infinite loop) + when: + - evaluate: 'CI_COMMIT_MESSAGE not contains "chore(release):"' + commands: + # Install dependencies + - apk add --no-cache git curl perl + + # Install Cocogitto + - curl -sSL https://github.com/cocogitto/cocogitto/releases/latest/download/cocogitto-6.5.0-x86_64-unknown-linux-musl.tar.gz | tar xz + - mv cog /usr/local/bin/ + - cog --version + + # Configure Git + - git config --global user.name "woodpecker-ci[bot]" + - git config --global user.email "woodpecker-ci[bot]@noreply.local" + - git config --global --add safe.directory "$CI_WORKSPACE" + + # Fetch full history (Woodpecker does shallow clone by default) + - git fetch --unshallow --tags || git fetch --tags + + # Check if there are commits to bump + - | + if cog bump --auto --dry-run 2>&1 | grep -qE "(No conventional commits|already on)"; then + echo "No version bump needed" + exit 0 + fi + + # Bump version + - cog bump --auto + + # Push changes and tags using PAT + - git remote set-url origin "https://x-access-token:$GITHUB_TOKEN@github.com/${CI_REPO}.git" + - git push origin HEAD:main + - git push origin --tags + secrets: + - GITHUB_TOKEN diff --git a/CLAUDE.md b/CLAUDE.md index 009d388..17696c7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -61,3 +61,39 @@ Tests use xUnit with FluentAssertions for assertions, NSubstitute for mocking, a - Use [Conventional Commits](https://www.conventionalcommits.org/) - version bumps are automatic based on commit type (`fix:` = patch, `feat:` = minor, `feat!:` = major) - Trunk-based development: feature branches merge directly to `main` - All destructive operations (delete, bulk operations) require explicit `confirm=true` and default to dry-run mode + +## Versioning with Cocogitto (cog) + +This repo uses [Cocogitto](https://docs.cocogitto.io/) for conventional commit enforcement and version management. + +**Git hook:** A `commit-msg` hook enforces conventional commits. Install it after cloning: +```bash +cog install-hook commit-msg +``` + +**Commit format:** +``` +[optional scope]: + +[optional body] + +[optional footer(s)] +``` + +Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert` + +**Version bumping:** +```bash +cog bump --auto # Auto-detect bump type from commits +cog bump --patch # Bump patch version (0.1.12 -> 0.1.13) +cog bump --minor # Bump minor version (0.1.12 -> 0.2.0) +cog bump --major # Bump major version (0.1.12 -> 1.0.0) +cog bump --dry-run # Preview what would happen +``` + +**Other useful commands:** +```bash +cog check # Verify all commits follow conventional format +cog changelog # Generate changelog +cog get-version # Show current version +``` diff --git a/PaperlessMCP/PaperlessMCP.csproj b/PaperlessMCP/PaperlessMCP.csproj index b5c8e18..1e3d973 100644 --- a/PaperlessMCP/PaperlessMCP.csproj +++ b/PaperlessMCP/PaperlessMCP.csproj @@ -1,6 +1,7 @@ + 0.1.12 net10.0 enable enable diff --git a/cog.toml b/cog.toml new file mode 100644 index 0000000..f903d13 --- /dev/null +++ b/cog.toml @@ -0,0 +1,53 @@ +# Cocogitto configuration +# https://docs.cocogitto.io/ + +from_latest_tag = true +tag_prefix = "v" +branch_whitelist = ["main"] +skip_ci = "[skip ci]" +skip_untracked = false +ignore_merge_commits = true +disable_changelog = false +disable_bump_commit = false + +# Pre-bump hooks run before the version is bumped +pre_bump_hooks = [] + +# Post-bump hooks run after version bump but before commit +# Updates the Version element in the .csproj file +# Uses perl for cross-platform compatibility (macOS sed differs from GNU sed) +# Regex anchors to line start to avoid replacing PackageReference versions +post_bump_hooks = [ + "perl -i -pe 's/^(\\s*).*<\\/Version>/$1{{version}}<\\/Version>/' PaperlessMCP/PaperlessMCP.csproj", +] + +# Git hooks configuration +# Validates commit messages follow conventional commit format +[git_hooks.commit-msg] +script = """#!/bin/sh +set -e +cog verify --file $1 +""" + +# Changelog configuration +[changelog] +path = "CHANGELOG.md" +template = "remote" +remote = "github.com" +repository = "PaperlessMCP" +owner = "barryw" + +# Commit type configurations +# Types that bump versions are marked accordingly +[commit_types] +feat = { changelog_title = "Features", bump_minor = true } +fix = { changelog_title = "Bug Fixes", bump_patch = true } +docs = { changelog_title = "Documentation" } +style = { changelog_title = "Styling" } +refactor = { changelog_title = "Refactoring" } +perf = { changelog_title = "Performance", bump_patch = true } +test = { changelog_title = "Tests" } +build = { changelog_title = "Build" } +ci = { changelog_title = "CI/CD" } +chore = { changelog_title = "Chores" } +revert = { changelog_title = "Reverts", bump_patch = true }