Skip to content

Commit 9bc0f06

Browse files
authored
feat: migrate to setuptools-scm and automated releases
1 parent 55add89 commit 9bc0f06

23 files changed

Lines changed: 884 additions & 2856 deletions

.gitattributes

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

.github/workflows/build_jar.yml

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

1616
steps:
1717
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0 # Fetch all history for version detection
20+
fetch-tags: true # Explicitly fetch tags
21+
22+
- name: Fetch git tags
23+
run: git fetch --force --tags
24+
25+
- name: Set up Python (for version script)
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.11'
29+
30+
- name: Update version files
31+
run: |
32+
python -m pip install setuptools-scm
33+
python scripts/update_versions.py
34+
1835
- name: Set up JDK 11
1936
uses: actions/setup-java@v1
2037
with:
@@ -30,12 +47,25 @@ jobs:
3047
needs: [build_and_test]
3148
steps:
3249
- uses: actions/checkout@v3
50+
with:
51+
fetch-depth: 0 # Fetch all history for version detection
52+
53+
- name: Set up Python (for version script)
54+
uses: actions/setup-python@v5
55+
with:
56+
python-version: '3.11'
57+
58+
- name: Update version files
59+
run: |
60+
python -m pip install setuptools-scm
61+
python scripts/update_versions.py
62+
3363
- uses: actions/setup-java@v3
3464
with:
3565
java-version: 11
3666
distribution: 'temurin'
3767
architecture: x64
38-
68+
3969
- run: mvn -B package --file pom.xml -DskipTests
4070
- run: mkdir staging && cp target/*jar-with-dependencies.jar staging
4171
- uses: actions/upload-artifact@v4

.github/workflows/build_wheels.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ jobs:
2323
steps:
2424
- uses: actions/checkout@v3
2525
name: Check out
26+
with:
27+
fetch-depth: 0 # Fetch all history for setuptools-scm
28+
fetch-tags: true # Explicitly fetch tags
29+
30+
- name: Fetch git tags
31+
run: git fetch --force --tags
32+
shell: bash
2633

2734
- uses: ilammy/msvc-dev-cmd@v1
2835
name: Add MSVS Path
@@ -32,6 +39,12 @@ jobs:
3239
with:
3340
python-version: '3.11'
3441

42+
- name: Update version files
43+
run: |
44+
python -m pip install setuptools-scm
45+
python scripts/update_versions.py
46+
shell: bash
47+
3548
- name: Install cibuildwheel
3649
run: |
3750
python -m pip install cibuildwheel delvewheel wheel
@@ -82,6 +95,13 @@ jobs:
8295
steps:
8396
- uses: actions/checkout@v3
8497
name: Check out
98+
with:
99+
fetch-depth: 0 # Fetch all history for setuptools-scm
100+
fetch-tags: true # Explicitly fetch tags
101+
102+
- name: Fetch git tags
103+
run: git fetch --force --tags
104+
shell: bash
85105

86106
- uses: ilammy/msvc-dev-cmd@v1
87107
name: Add MSVS Path
@@ -90,7 +110,13 @@ jobs:
90110
name: Install Python
91111
with:
92112
python-version: '3.11'
93-
113+
114+
- name: Update version files
115+
run: |
116+
python -m pip install setuptools-scm
117+
python scripts/update_versions.py
118+
shell: bash
119+
94120
- name: Install cibuildwheel
95121
run: |
96122
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: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v3
2323
name: Check out
24+
with:
25+
fetch-depth: 0 # Fetch all history for setuptools-scm
26+
fetch-tags: true # Explicitly fetch tags
2427

28+
- name: Fetch git tags
29+
run: git fetch --force --tags
30+
shell: bash
2531

2632
- uses: ilammy/msvc-dev-cmd@v1
2733
name: Add MSVS Path
@@ -31,6 +37,19 @@ jobs:
3137
with:
3238
python-version: '3.11'
3339

40+
- name: Update version files
41+
run: |
42+
python -m pip install setuptools-scm
43+
# Extract version from tag name if this is a release
44+
if [ -n "$GITHUB_REF_NAME" ] && [[ "$GITHUB_REF_NAME" == v* ]]; then
45+
VERSION="${GITHUB_REF_NAME#v}"
46+
echo "Using release version: $VERSION"
47+
python scripts/update_versions.py --version "$VERSION"
48+
else
49+
python scripts/update_versions.py
50+
fi
51+
shell: bash
52+
3453
- name: Install cibuildwheel
3554
run: |
3655
python -m pip install cibuildwheel delvewheel wheel
@@ -84,6 +103,13 @@ jobs:
84103
steps:
85104
- uses: actions/checkout@v3
86105
name: Check out
106+
with:
107+
fetch-depth: 0 # Fetch all history for setuptools-scm
108+
fetch-tags: true # Explicitly fetch tags
109+
110+
- name: Fetch git tags
111+
run: git fetch --force --tags
112+
shell: bash
87113

88114
- uses: ilammy/msvc-dev-cmd@v1
89115
name: Add MSVS Path
@@ -92,7 +118,20 @@ jobs:
92118
name: Install Python
93119
with:
94120
python-version: '3.11'
95-
121+
122+
- name: Update version files
123+
run: |
124+
python -m pip install setuptools-scm
125+
# Extract version from tag name if this is a release
126+
if [ -n "$GITHUB_REF_NAME" ] && [[ "$GITHUB_REF_NAME" == v* ]]; then
127+
VERSION="${GITHUB_REF_NAME#v}"
128+
echo "Using release version: $VERSION"
129+
python scripts/update_versions.py --version "$VERSION"
130+
else
131+
python scripts/update_versions.py
132+
fi
133+
shell: bash
134+
96135
- name: Install cibuildwheel
97136
run: |
98137
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+
})

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ data/
44

55
# Test file
66
test.py
7+
test_*.py
8+
9+
# Local build artifacts
10+
local_install/
11+
pybind11*/
12+
*.zip
13+
*.ogv
714

815
# Prerequisites
916
*.d

.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+
}

.version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.1.4

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)