Skip to content

Commit 676393c

Browse files
sameeulclaude
andcommitted
feat!: migrate to setuptools-scm and automated releases
BREAKING CHANGE: Version management system changed from versioneer to setuptools-scm. This enables automated releases via release-please and eliminates manual version updates. Changes: - Remove versioneer artifacts (versioneer.py, _version.py, .gitattributes) - Add modern pyproject.toml configuration with setuptools-scm - Eliminate src/filepattern/cpp/version.h (not needed - CMake now reads from VERSION file) - Add automated version sync script (scripts/update_versions.py) - Add release-please workflow for automated releases - Update all CI/CD workflows to sync versions before building - Add CONTRIBUTING.md with conventional commit guidelines - Add MIGRATION_TO_SETUPTOOLS_SCM.md with detailed migration guide - Update README.md with new release process Version file reduction: - Before: 3 files to update manually (pom.xml, version.h, git tags) - After: 2 files, auto-synced (VERSION, pom.xml) from git tags New workflow: 1. Use conventional commits (feat:, fix:, etc.) 2. Push to master 3. release-please creates Release PR with version bump 4. Merge Release PR -> automated release and publishing Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent f80663c commit 676393c

22 files changed

+917
-2857
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/build_jar.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,19 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0 # Fetch all history for version detection
20+
21+
- name: Set up Python (for version script)
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.11'
25+
26+
- name: Update version files
27+
run: |
28+
python -m pip install setuptools-scm
29+
python scripts/update_versions.py
30+
1831
- name: Set up JDK 11
1932
uses: actions/setup-java@v1
2033
with:
@@ -30,12 +43,25 @@ jobs:
3043
needs: [build_and_test]
3144
steps:
3245
- uses: actions/checkout@v3
46+
with:
47+
fetch-depth: 0 # Fetch all history for version detection
48+
49+
- name: Set up Python (for version script)
50+
uses: actions/setup-python@v5
51+
with:
52+
python-version: '3.11'
53+
54+
- name: Update version files
55+
run: |
56+
python -m pip install setuptools-scm
57+
python scripts/update_versions.py
58+
3359
- uses: actions/setup-java@v3
3460
with:
3561
java-version: 11
3662
distribution: 'temurin'
3763
architecture: x64
38-
64+
3965
- run: mvn -B package --file pom.xml -DskipTests
4066
- run: mkdir staging && cp target/*jar-with-dependencies.jar staging
4167
- uses: actions/upload-artifact@v4

.github/workflows/build_wheels.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@v3
2525
name: Check out
26+
with:
27+
fetch-depth: 0 # Fetch all history for setuptools-scm
2628

2729
- uses: ilammy/msvc-dev-cmd@v1
2830
name: Add MSVS Path
@@ -32,6 +34,12 @@ jobs:
3234
with:
3335
python-version: '3.11'
3436

37+
- name: Update version files
38+
run: |
39+
python -m pip install setuptools-scm
40+
python scripts/update_versions.py
41+
shell: bash
42+
3543
- name: Install cibuildwheel
3644
run: |
3745
python -m pip install cibuildwheel delvewheel wheel
@@ -82,6 +90,8 @@ jobs:
8290
steps:
8391
- uses: actions/checkout@v3
8492
name: Check out
93+
with:
94+
fetch-depth: 0 # Fetch all history for setuptools-scm
8595

8696
- uses: ilammy/msvc-dev-cmd@v1
8797
name: Add MSVS Path
@@ -90,7 +100,13 @@ jobs:
90100
name: Install Python
91101
with:
92102
python-version: '3.11'
93-
103+
104+
- name: Update version files
105+
run: |
106+
python -m pip install setuptools-scm
107+
python scripts/update_versions.py
108+
shell: bash
109+
94110
- name: Install cibuildwheel
95111
run: |
96112
python -m pip install cibuildwheel delvewheel wheel

.github/workflows/publish_maven.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0 # Fetch all history for version detection
15+
16+
- name: Set up Python (for version script)
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.11'
20+
21+
- name: Update version files
22+
run: |
23+
python -m pip install setuptools-scm
24+
python scripts/update_versions.py
25+
1326
- name: Set up Maven Central Repository
1427
uses: actions/setup-java@v3
1528
with:
@@ -21,6 +34,7 @@ jobs:
2134
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Substituted with the value stored in the referenced secret
2235
gpg-passphrase: SIGN_KEY_PASS # Env var that holds the key's passphrase
2336
cache: 'maven'
37+
2438
- name: Build & Deploy
2539
run: |
2640
# -U force updates just to make sure we are using latest dependencies

.github/workflows/publish_pypi.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v3
2323
name: Check out
24-
24+
with:
25+
fetch-depth: 0 # Fetch all history for setuptools-scm
2526

2627
- uses: ilammy/msvc-dev-cmd@v1
2728
name: Add MSVS Path
@@ -31,6 +32,12 @@ jobs:
3132
with:
3233
python-version: '3.11'
3334

35+
- name: Update version files
36+
run: |
37+
python -m pip install setuptools-scm
38+
python scripts/update_versions.py
39+
shell: bash
40+
3441
- name: Install cibuildwheel
3542
run: |
3643
python -m pip install cibuildwheel delvewheel wheel
@@ -84,6 +91,8 @@ jobs:
8491
steps:
8592
- uses: actions/checkout@v3
8693
name: Check out
94+
with:
95+
fetch-depth: 0 # Fetch all history for setuptools-scm
8796

8897
- uses: ilammy/msvc-dev-cmd@v1
8998
name: Add MSVS Path
@@ -92,7 +101,13 @@ jobs:
92101
name: Install Python
93102
with:
94103
python-version: '3.11'
95-
104+
105+
- name: Update version files
106+
run: |
107+
python -m pip install setuptools-scm
108+
python scripts/update_versions.py
109+
shell: bash
110+
96111
- name: Install cibuildwheel
97112
run: |
98113
python -m pip install cibuildwheel delvewheel wheel
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release-please:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
release_created: ${{ steps.release.outputs.release_created }}
17+
tag_name: ${{ steps.release.outputs.tag_name }}
18+
version: ${{ steps.release.outputs.version }}
19+
steps:
20+
- uses: google-github-actions/release-please-action@v4
21+
id: release
22+
with:
23+
release-type: python
24+
package-name: filepattern
25+
26+
# If a release was created, update version files and create a follow-up commit
27+
- name: Checkout code
28+
if: ${{ steps.release.outputs.release_created }}
29+
uses: actions/checkout@v4
30+
with:
31+
ref: ${{ steps.release.outputs.tag_name }}
32+
33+
- name: Set up Python
34+
if: ${{ steps.release.outputs.release_created }}
35+
uses: actions/setup-python@v5
36+
with:
37+
python-version: '3.11'
38+
39+
- name: Install setuptools-scm
40+
if: ${{ steps.release.outputs.release_created }}
41+
run: pip install setuptools-scm
42+
43+
- name: Update version files
44+
if: ${{ steps.release.outputs.release_created }}
45+
run: |
46+
python scripts/update_versions.py --version ${{ steps.release.outputs.version }}
47+
echo "Updated version files to ${{ steps.release.outputs.version }}"
48+
49+
- name: Upload VERSION file as release asset
50+
if: ${{ steps.release.outputs.release_created }}
51+
env:
52+
GH_TOKEN: ${{ github.token }}
53+
run: |
54+
gh release upload ${{ steps.release.outputs.tag_name }} VERSION --clobber
55+
56+
trigger-publish:
57+
needs: release-please
58+
if: ${{ needs.release-please.outputs.release_created }}
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Trigger PyPI publish
62+
uses: actions/github-script@v7
63+
with:
64+
script: |
65+
github.rest.actions.createWorkflowDispatch({
66+
owner: context.repo.owner,
67+
repo: context.repo.repo,
68+
workflow_id: 'publish_pypi.yml',
69+
ref: '${{ needs.release-please.outputs.tag_name }}'
70+
})
71+
72+
- name: Trigger Maven publish
73+
uses: actions/github-script@v7
74+
with:
75+
script: |
76+
github.rest.actions.createWorkflowDispatch({
77+
owner: context.repo.owner,
78+
repo: context.repo.repo,
79+
workflow_id: 'publish_maven.yml',
80+
ref: '${{ needs.release-please.outputs.tag_name }}'
81+
})

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "2.1.4"
3+
}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
This file is automatically generated by [release-please](https://github.com/googleapis/release-please). Do not edit manually.
6+
7+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
9+
10+
## [2.1.4](https://github.com/PolusAI/filepattern/releases/tag/v2.1.4) (2025-03-10)
11+
12+
### Bug Fixes
13+
14+
* handle non-alphanumeric characters in infer_pattern ([#102](https://github.com/PolusAI/filepattern/pull/102))

0 commit comments

Comments
 (0)