tinysemver 1.1.3__tar.gz → 1.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tinysemver-1.1.3/tinysemver.egg-info → tinysemver-1.3.2}/PKG-INFO +118 -18
- {tinysemver-1.1.3 → tinysemver-1.3.2}/README.md +112 -17
- {tinysemver-1.1.3 → tinysemver-1.3.2}/pyproject.toml +8 -1
- {tinysemver-1.1.3 → tinysemver-1.3.2/tinysemver.egg-info}/PKG-INFO +118 -18
- {tinysemver-1.1.3 → tinysemver-1.3.2}/LICENSE +0 -0
- {tinysemver-1.1.3 → tinysemver-1.3.2}/setup.cfg +0 -0
- {tinysemver-1.1.3 → tinysemver-1.3.2}/tinysemver.egg-info/SOURCES.txt +0 -0
- {tinysemver-1.1.3 → tinysemver-1.3.2}/tinysemver.egg-info/dependency_links.txt +0 -0
- {tinysemver-1.1.3 → tinysemver-1.3.2}/tinysemver.egg-info/entry_points.txt +0 -0
- {tinysemver-1.1.3 → tinysemver-1.3.2}/tinysemver.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tinysemver
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.2
|
|
4
4
|
Summary: Tiny Semantic Versioning (SemVer) library, that doesn't depend on 300K lines of JavaScript
|
|
5
5
|
Author-email: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>
|
|
6
6
|
License: Apache License
|
|
@@ -205,6 +205,11 @@ License: Apache License
|
|
|
205
205
|
See the License for the specific language governing permissions and
|
|
206
206
|
limitations under the License.
|
|
207
207
|
|
|
208
|
+
Project-URL: Homepage, https://pypi.org/project/tinysemver/
|
|
209
|
+
Project-URL: Documentation, https://github.com/ashvardanian/tinysemver/blob/main/README.md
|
|
210
|
+
Project-URL: Repository, https://github.com/ashvardanian/tinysemver.git
|
|
211
|
+
Project-URL: Issues, https://github.com/ashvardanian/tinysemver/issues
|
|
212
|
+
Project-URL: Changelog, https://github.com/ashvardanian/tinysemver/blob/main/CHANGELOG.md
|
|
208
213
|
Classifier: Development Status :: 4 - Beta
|
|
209
214
|
Classifier: Intended Audience :: Developers
|
|
210
215
|
Classifier: Topic :: Software Development :: Build Tools
|
|
@@ -234,21 +239,40 @@ $ tinysemver --dry-run --verbose
|
|
|
234
239
|
|
|
235
240
|
The `--dry-run` flag will only print the next version without changing any files.
|
|
236
241
|
Great for pre-release CI pipelines.
|
|
237
|
-
If you need more control over the default specification, here are more options:
|
|
242
|
+
If you need more control over the default specification, here are more options you can run against the files in this repository:
|
|
238
243
|
|
|
239
244
|
```sh
|
|
245
|
+
# This won't push
|
|
240
246
|
$ tinysemver --verbose \
|
|
241
247
|
--major-verbs 'breaking,break,major' \
|
|
242
248
|
--minor-verbs 'feature,minor,add,new' \
|
|
243
249
|
--patch-verbs 'fix,patch,bug,improve' \
|
|
244
250
|
--changelog-file 'CHANGELOG.md' \
|
|
245
251
|
--version-file 'VERSION' \
|
|
252
|
+
--update-version-in 'pyproject.toml' '^version = "(\d+\.\d+\.\d+)"' \
|
|
253
|
+
--github-repository 'ashvardanian/tinysemver'
|
|
254
|
+
# Revert to the previous commit
|
|
255
|
+
$ git reset --soft HEAD~1
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
It's recommended to use strict version matching with `\d+\.\d+\.\d+` instead of a generic wildcard like `.*`, but both would work.
|
|
259
|
+
Here is an example of passing even more parameters for a project like `stringzilla`:
|
|
260
|
+
|
|
261
|
+
```sh
|
|
262
|
+
$ tinysemver --verbose \
|
|
263
|
+
--major-verbs 'breaking,break,major' \
|
|
264
|
+
--minor-verbs 'feature,minor,add,new' \
|
|
265
|
+
--patch-verbs 'fix,patch,bug,improve' \
|
|
266
|
+
--changelog-file 'CHANGELOG.md' \
|
|
267
|
+
--version-file 'VERSION' \
|
|
268
|
+
--update-version-in 'pyproject.toml' '^version = "(\d+\.\d+\.\d+)"' \
|
|
246
269
|
--update-version-in 'package.json' '"version": "(.*)"' \
|
|
247
270
|
--update-version-in 'CITATION.cff' '^version: (.*)' \
|
|
248
271
|
--update-major-version-in 'include/stringzilla/stringzilla.h' '^#define STRINGZILLA_VERSION_MAJOR (.*)' \
|
|
249
272
|
--update-minor-version-in 'include/stringzilla/stringzilla.h' '^#define STRINGZILLA_VERSION_MINOR (.*)' \
|
|
250
273
|
--update-patch-version-in 'include/stringzilla/stringzilla.h' '^#define STRINGZILLA_VERSION_PATCH (.*)' \
|
|
251
|
-
--github-repository 'ashvardanian/stringzilla'
|
|
274
|
+
--github-repository 'ashvardanian/stringzilla' \
|
|
275
|
+
--push
|
|
252
276
|
> Current version: 1.2.2
|
|
253
277
|
> ? Commits since last tag: 3 # Only in verbose mode
|
|
254
278
|
> # 5579972: Improve: Log file patches # Only in verbose mode
|
|
@@ -260,6 +284,9 @@ $ tinysemver --verbose \
|
|
|
260
284
|
> Will update file: package.json:5
|
|
261
285
|
> - "version": "1.2.2" # Only in verbose mode
|
|
262
286
|
> + "version": "1.3.0" # Only in verbose mode
|
|
287
|
+
> Will update file: pyproject.toml:7
|
|
288
|
+
> - version = "1.2.2" # Only in verbose mode
|
|
289
|
+
> + version = "1.3.0" # Only in verbose mode
|
|
263
290
|
> Will update file: CITATION.cff:7
|
|
264
291
|
> - version: 1.2.2 # Only in verbose mode
|
|
265
292
|
> + version: 1.3.0 # Only in verbose mode
|
|
@@ -274,6 +301,66 @@ Alternatively, you can just ask for `--help`:
|
|
|
274
301
|
$ tinysemver --help
|
|
275
302
|
```
|
|
276
303
|
|
|
304
|
+
## Use the Action
|
|
305
|
+
|
|
306
|
+
```yaml
|
|
307
|
+
name: CI
|
|
308
|
+
|
|
309
|
+
on:
|
|
310
|
+
push:
|
|
311
|
+
branches: [ main ]
|
|
312
|
+
|
|
313
|
+
jobs:
|
|
314
|
+
build:
|
|
315
|
+
# Add this condition to skip recursive releases
|
|
316
|
+
if: "!contains(github.event.head_commit.message, 'Release:')"
|
|
317
|
+
runs-on: ubuntu-latest
|
|
318
|
+
|
|
319
|
+
steps:
|
|
320
|
+
- uses: actions/checkout@v4
|
|
321
|
+
with:
|
|
322
|
+
persist-credentials: false # only if main branch if protected
|
|
323
|
+
# Your existing steps...
|
|
324
|
+
|
|
325
|
+
- name: Run TinySemVer
|
|
326
|
+
uses: your-username/tinysemver@v1
|
|
327
|
+
with:
|
|
328
|
+
dry-run: 'true'
|
|
329
|
+
verbose: 'true'
|
|
330
|
+
push: 'true'
|
|
331
|
+
major-verbs: 'breaking,break,major'
|
|
332
|
+
minor-verbs: 'feature,minor,add,new'
|
|
333
|
+
patch-verbs: 'fix,patch,bug,improve,docs'
|
|
334
|
+
changelog-file: 'CHANGELOG.md'
|
|
335
|
+
version-file: 'VERSION'
|
|
336
|
+
update-version-in: 'pyproject.toml,version = "(.*)"'
|
|
337
|
+
git-user-name: 'GitHub Actions'
|
|
338
|
+
git-user-email: 'actions@github.com'
|
|
339
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
340
|
+
create-release: 'true'
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Security Considerations for Protected Branches
|
|
344
|
+
|
|
345
|
+
If your default branch is protected with a "pull request before merging" rule:
|
|
346
|
+
|
|
347
|
+
1. A repository-scoped Personal Access Token (PAT) is required to push to the branch.
|
|
348
|
+
2. Set `persist-credentials: false` in the `actions/checkout` step.
|
|
349
|
+
|
|
350
|
+
⚠️ **Important Security Note:**
|
|
351
|
+
- The default `GITHUB_TOKEN` cannot be used with protected branches.
|
|
352
|
+
- Using a PAT instead of `GITHUB_TOKEN` poses security risks:
|
|
353
|
+
- Workflows from any branch can access secret variables.
|
|
354
|
+
- This could allow non-protected branches to use elevated permissions.
|
|
355
|
+
- Mitigation:
|
|
356
|
+
- Use a fine-grained PAT with minimal necessary permissions.
|
|
357
|
+
- Prefer the `pull_request` workflow trigger, which limits permissions.
|
|
358
|
+
- Be cautious: users with write access could still potentially exploit workflows to expose the PAT.
|
|
359
|
+
|
|
360
|
+
Always follow the principle of least privilege when setting up tokens and permissions.
|
|
361
|
+
|
|
362
|
+
For more information on CI configurations and pushing changes in GitHub Actions, see the [semantic-release GitHub Actions guide](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/ci-configurations/github-actions.md#pushing-packagejson-changes-to-a-master-branch).
|
|
363
|
+
|
|
277
364
|
## Why?
|
|
278
365
|
|
|
279
366
|
In the past I was using [semantic-release](https://github.com/semantic-release/semantic-release) for my 10+ projects.
|
|
@@ -378,24 +465,24 @@ Probably very useful for 2-3 projects, I didn't need to support any of them yet.
|
|
|
378
465
|
## Examples
|
|
379
466
|
|
|
380
467
|
Assembling RegEx queries can be hard.
|
|
381
|
-
Luckily, there aren't too
|
|
468
|
+
Luckily, there aren't too many files to update in most projects.
|
|
382
469
|
Below is an example of a pipeline for the USearch project, that has bindings to 10 programming languages.
|
|
383
470
|
Feel free to add other sources and examples.
|
|
384
471
|
|
|
385
472
|
```sh
|
|
386
473
|
$ mkdir -p example
|
|
387
474
|
|
|
388
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/VERSION -
|
|
389
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/CHANGELOG.md -
|
|
390
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/CITATION.cff -
|
|
391
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/CMakeLists.txt -
|
|
392
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/Cargo.toml -
|
|
393
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/package.json -
|
|
394
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/conanfile.py -
|
|
395
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/README.md -
|
|
396
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/wasmer.toml -
|
|
397
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/csharp/nuget/nuget-package.props -
|
|
398
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/include/usearch/index.hpp -
|
|
475
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/VERSION -P example/
|
|
476
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/CHANGELOG.md -P example/ # Missing
|
|
477
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/CITATION.cff -P example/
|
|
478
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/CMakeLists.txt -P example/
|
|
479
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/Cargo.toml -P example/
|
|
480
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/package.json -P example/
|
|
481
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/conanfile.py -P example/
|
|
482
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/README.md -P example/
|
|
483
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/wasmer.toml -P example/
|
|
484
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/csharp/nuget/nuget-package.props -P example/
|
|
485
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/include/usearch/index.hpp -P example/
|
|
399
486
|
|
|
400
487
|
# You can match the semantic version part with a generic wildcard like: .*
|
|
401
488
|
# But it's recommended to stick to a stricter format: \d+\.\d+\.\d+
|
|
@@ -413,8 +500,21 @@ $ tinysemver --dry-run --verbose \
|
|
|
413
500
|
--update-version-in 'example/README.md' '^version = \{(\d+\.\d+\.\d+)\}' \
|
|
414
501
|
--update-version-in 'example/wasmer.toml' '^version = "(\d+\.\d+\.\d+)"' \
|
|
415
502
|
--update-version-in 'example/nuget-package.props' '(\d+\.\d+\.\d+)\<\/Version\>' \
|
|
416
|
-
--update-major-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MAJOR (\d)' \
|
|
417
|
-
--update-minor-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MINOR (\d)' \
|
|
418
|
-
--update-patch-version-in 'example/index.hpp' '^#define USEARCH_VERSION_PATCH (\d)' \
|
|
503
|
+
--update-major-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MAJOR (\d+)' \
|
|
504
|
+
--update-minor-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MINOR (\d+)' \
|
|
505
|
+
--update-patch-version-in 'example/index.hpp' '^#define USEARCH_VERSION_PATCH (\d+)' \
|
|
419
506
|
--path .
|
|
420
507
|
```
|
|
508
|
+
|
|
509
|
+
## Contributing
|
|
510
|
+
|
|
511
|
+
Feel free to open an issue or a pull request.
|
|
512
|
+
If you need to bump the version of `tinysemver` itself:
|
|
513
|
+
|
|
514
|
+
```sh
|
|
515
|
+
tinysemver --verbose \
|
|
516
|
+
--version-file 'VERSION' \
|
|
517
|
+
--changelog-file 'CHANGELOG.md' \
|
|
518
|
+
--update-version-in 'pyproject.toml' 'version = "(.*)"' \
|
|
519
|
+
--github-repository 'ashvardanian/tinysemver' --push
|
|
520
|
+
```
|
|
@@ -13,21 +13,40 @@ $ tinysemver --dry-run --verbose
|
|
|
13
13
|
|
|
14
14
|
The `--dry-run` flag will only print the next version without changing any files.
|
|
15
15
|
Great for pre-release CI pipelines.
|
|
16
|
-
If you need more control over the default specification, here are more options:
|
|
16
|
+
If you need more control over the default specification, here are more options you can run against the files in this repository:
|
|
17
17
|
|
|
18
18
|
```sh
|
|
19
|
+
# This won't push
|
|
19
20
|
$ tinysemver --verbose \
|
|
20
21
|
--major-verbs 'breaking,break,major' \
|
|
21
22
|
--minor-verbs 'feature,minor,add,new' \
|
|
22
23
|
--patch-verbs 'fix,patch,bug,improve' \
|
|
23
24
|
--changelog-file 'CHANGELOG.md' \
|
|
24
25
|
--version-file 'VERSION' \
|
|
26
|
+
--update-version-in 'pyproject.toml' '^version = "(\d+\.\d+\.\d+)"' \
|
|
27
|
+
--github-repository 'ashvardanian/tinysemver'
|
|
28
|
+
# Revert to the previous commit
|
|
29
|
+
$ git reset --soft HEAD~1
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
It's recommended to use strict version matching with `\d+\.\d+\.\d+` instead of a generic wildcard like `.*`, but both would work.
|
|
33
|
+
Here is an example of passing even more parameters for a project like `stringzilla`:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
$ tinysemver --verbose \
|
|
37
|
+
--major-verbs 'breaking,break,major' \
|
|
38
|
+
--minor-verbs 'feature,minor,add,new' \
|
|
39
|
+
--patch-verbs 'fix,patch,bug,improve' \
|
|
40
|
+
--changelog-file 'CHANGELOG.md' \
|
|
41
|
+
--version-file 'VERSION' \
|
|
42
|
+
--update-version-in 'pyproject.toml' '^version = "(\d+\.\d+\.\d+)"' \
|
|
25
43
|
--update-version-in 'package.json' '"version": "(.*)"' \
|
|
26
44
|
--update-version-in 'CITATION.cff' '^version: (.*)' \
|
|
27
45
|
--update-major-version-in 'include/stringzilla/stringzilla.h' '^#define STRINGZILLA_VERSION_MAJOR (.*)' \
|
|
28
46
|
--update-minor-version-in 'include/stringzilla/stringzilla.h' '^#define STRINGZILLA_VERSION_MINOR (.*)' \
|
|
29
47
|
--update-patch-version-in 'include/stringzilla/stringzilla.h' '^#define STRINGZILLA_VERSION_PATCH (.*)' \
|
|
30
|
-
--github-repository 'ashvardanian/stringzilla'
|
|
48
|
+
--github-repository 'ashvardanian/stringzilla' \
|
|
49
|
+
--push
|
|
31
50
|
> Current version: 1.2.2
|
|
32
51
|
> ? Commits since last tag: 3 # Only in verbose mode
|
|
33
52
|
> # 5579972: Improve: Log file patches # Only in verbose mode
|
|
@@ -39,6 +58,9 @@ $ tinysemver --verbose \
|
|
|
39
58
|
> Will update file: package.json:5
|
|
40
59
|
> - "version": "1.2.2" # Only in verbose mode
|
|
41
60
|
> + "version": "1.3.0" # Only in verbose mode
|
|
61
|
+
> Will update file: pyproject.toml:7
|
|
62
|
+
> - version = "1.2.2" # Only in verbose mode
|
|
63
|
+
> + version = "1.3.0" # Only in verbose mode
|
|
42
64
|
> Will update file: CITATION.cff:7
|
|
43
65
|
> - version: 1.2.2 # Only in verbose mode
|
|
44
66
|
> + version: 1.3.0 # Only in verbose mode
|
|
@@ -53,6 +75,66 @@ Alternatively, you can just ask for `--help`:
|
|
|
53
75
|
$ tinysemver --help
|
|
54
76
|
```
|
|
55
77
|
|
|
78
|
+
## Use the Action
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
name: CI
|
|
82
|
+
|
|
83
|
+
on:
|
|
84
|
+
push:
|
|
85
|
+
branches: [ main ]
|
|
86
|
+
|
|
87
|
+
jobs:
|
|
88
|
+
build:
|
|
89
|
+
# Add this condition to skip recursive releases
|
|
90
|
+
if: "!contains(github.event.head_commit.message, 'Release:')"
|
|
91
|
+
runs-on: ubuntu-latest
|
|
92
|
+
|
|
93
|
+
steps:
|
|
94
|
+
- uses: actions/checkout@v4
|
|
95
|
+
with:
|
|
96
|
+
persist-credentials: false # only if main branch if protected
|
|
97
|
+
# Your existing steps...
|
|
98
|
+
|
|
99
|
+
- name: Run TinySemVer
|
|
100
|
+
uses: your-username/tinysemver@v1
|
|
101
|
+
with:
|
|
102
|
+
dry-run: 'true'
|
|
103
|
+
verbose: 'true'
|
|
104
|
+
push: 'true'
|
|
105
|
+
major-verbs: 'breaking,break,major'
|
|
106
|
+
minor-verbs: 'feature,minor,add,new'
|
|
107
|
+
patch-verbs: 'fix,patch,bug,improve,docs'
|
|
108
|
+
changelog-file: 'CHANGELOG.md'
|
|
109
|
+
version-file: 'VERSION'
|
|
110
|
+
update-version-in: 'pyproject.toml,version = "(.*)"'
|
|
111
|
+
git-user-name: 'GitHub Actions'
|
|
112
|
+
git-user-email: 'actions@github.com'
|
|
113
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
114
|
+
create-release: 'true'
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Security Considerations for Protected Branches
|
|
118
|
+
|
|
119
|
+
If your default branch is protected with a "pull request before merging" rule:
|
|
120
|
+
|
|
121
|
+
1. A repository-scoped Personal Access Token (PAT) is required to push to the branch.
|
|
122
|
+
2. Set `persist-credentials: false` in the `actions/checkout` step.
|
|
123
|
+
|
|
124
|
+
⚠️ **Important Security Note:**
|
|
125
|
+
- The default `GITHUB_TOKEN` cannot be used with protected branches.
|
|
126
|
+
- Using a PAT instead of `GITHUB_TOKEN` poses security risks:
|
|
127
|
+
- Workflows from any branch can access secret variables.
|
|
128
|
+
- This could allow non-protected branches to use elevated permissions.
|
|
129
|
+
- Mitigation:
|
|
130
|
+
- Use a fine-grained PAT with minimal necessary permissions.
|
|
131
|
+
- Prefer the `pull_request` workflow trigger, which limits permissions.
|
|
132
|
+
- Be cautious: users with write access could still potentially exploit workflows to expose the PAT.
|
|
133
|
+
|
|
134
|
+
Always follow the principle of least privilege when setting up tokens and permissions.
|
|
135
|
+
|
|
136
|
+
For more information on CI configurations and pushing changes in GitHub Actions, see the [semantic-release GitHub Actions guide](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/ci-configurations/github-actions.md#pushing-packagejson-changes-to-a-master-branch).
|
|
137
|
+
|
|
56
138
|
## Why?
|
|
57
139
|
|
|
58
140
|
In the past I was using [semantic-release](https://github.com/semantic-release/semantic-release) for my 10+ projects.
|
|
@@ -157,24 +239,24 @@ Probably very useful for 2-3 projects, I didn't need to support any of them yet.
|
|
|
157
239
|
## Examples
|
|
158
240
|
|
|
159
241
|
Assembling RegEx queries can be hard.
|
|
160
|
-
Luckily, there aren't too
|
|
242
|
+
Luckily, there aren't too many files to update in most projects.
|
|
161
243
|
Below is an example of a pipeline for the USearch project, that has bindings to 10 programming languages.
|
|
162
244
|
Feel free to add other sources and examples.
|
|
163
245
|
|
|
164
246
|
```sh
|
|
165
247
|
$ mkdir -p example
|
|
166
248
|
|
|
167
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/VERSION -
|
|
168
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/CHANGELOG.md -
|
|
169
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/CITATION.cff -
|
|
170
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/CMakeLists.txt -
|
|
171
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/Cargo.toml -
|
|
172
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/package.json -
|
|
173
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/conanfile.py -
|
|
174
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/README.md -
|
|
175
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/wasmer.toml -
|
|
176
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/csharp/nuget/nuget-package.props -
|
|
177
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/include/usearch/index.hpp -
|
|
249
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/VERSION -P example/
|
|
250
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/CHANGELOG.md -P example/ # Missing
|
|
251
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/CITATION.cff -P example/
|
|
252
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/CMakeLists.txt -P example/
|
|
253
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/Cargo.toml -P example/
|
|
254
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/package.json -P example/
|
|
255
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/conanfile.py -P example/
|
|
256
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/README.md -P example/
|
|
257
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/wasmer.toml -P example/
|
|
258
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/csharp/nuget/nuget-package.props -P example/
|
|
259
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/include/usearch/index.hpp -P example/
|
|
178
260
|
|
|
179
261
|
# You can match the semantic version part with a generic wildcard like: .*
|
|
180
262
|
# But it's recommended to stick to a stricter format: \d+\.\d+\.\d+
|
|
@@ -192,8 +274,21 @@ $ tinysemver --dry-run --verbose \
|
|
|
192
274
|
--update-version-in 'example/README.md' '^version = \{(\d+\.\d+\.\d+)\}' \
|
|
193
275
|
--update-version-in 'example/wasmer.toml' '^version = "(\d+\.\d+\.\d+)"' \
|
|
194
276
|
--update-version-in 'example/nuget-package.props' '(\d+\.\d+\.\d+)\<\/Version\>' \
|
|
195
|
-
--update-major-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MAJOR (\d)' \
|
|
196
|
-
--update-minor-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MINOR (\d)' \
|
|
197
|
-
--update-patch-version-in 'example/index.hpp' '^#define USEARCH_VERSION_PATCH (\d)' \
|
|
277
|
+
--update-major-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MAJOR (\d+)' \
|
|
278
|
+
--update-minor-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MINOR (\d+)' \
|
|
279
|
+
--update-patch-version-in 'example/index.hpp' '^#define USEARCH_VERSION_PATCH (\d+)' \
|
|
198
280
|
--path .
|
|
199
281
|
```
|
|
282
|
+
|
|
283
|
+
## Contributing
|
|
284
|
+
|
|
285
|
+
Feel free to open an issue or a pull request.
|
|
286
|
+
If you need to bump the version of `tinysemver` itself:
|
|
287
|
+
|
|
288
|
+
```sh
|
|
289
|
+
tinysemver --verbose \
|
|
290
|
+
--version-file 'VERSION' \
|
|
291
|
+
--changelog-file 'CHANGELOG.md' \
|
|
292
|
+
--update-version-in 'pyproject.toml' 'version = "(.*)"' \
|
|
293
|
+
--github-repository 'ashvardanian/tinysemver' --push
|
|
294
|
+
```
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tinysemver"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.3.2"
|
|
8
8
|
description = "Tiny Semantic Versioning (SemVer) library, that doesn't depend on 300K lines of JavaScript"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { file = "LICENSE" }
|
|
@@ -28,6 +28,13 @@ classifiers = [
|
|
|
28
28
|
[project.scripts]
|
|
29
29
|
tinysemver = "tinysemver:main"
|
|
30
30
|
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://pypi.org/project/tinysemver/"
|
|
33
|
+
Documentation = "https://github.com/ashvardanian/tinysemver/blob/main/README.md"
|
|
34
|
+
Repository = "https://github.com/ashvardanian/tinysemver.git"
|
|
35
|
+
Issues = "https://github.com/ashvardanian/tinysemver/issues"
|
|
36
|
+
Changelog = "https://github.com/ashvardanian/tinysemver/blob/main/CHANGELOG.md"
|
|
37
|
+
|
|
31
38
|
[tool.setuptools]
|
|
32
39
|
package-dir = { "" = "." }
|
|
33
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: tinysemver
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.2
|
|
4
4
|
Summary: Tiny Semantic Versioning (SemVer) library, that doesn't depend on 300K lines of JavaScript
|
|
5
5
|
Author-email: Ash Vardanian <1983160+ashvardanian@users.noreply.github.com>
|
|
6
6
|
License: Apache License
|
|
@@ -205,6 +205,11 @@ License: Apache License
|
|
|
205
205
|
See the License for the specific language governing permissions and
|
|
206
206
|
limitations under the License.
|
|
207
207
|
|
|
208
|
+
Project-URL: Homepage, https://pypi.org/project/tinysemver/
|
|
209
|
+
Project-URL: Documentation, https://github.com/ashvardanian/tinysemver/blob/main/README.md
|
|
210
|
+
Project-URL: Repository, https://github.com/ashvardanian/tinysemver.git
|
|
211
|
+
Project-URL: Issues, https://github.com/ashvardanian/tinysemver/issues
|
|
212
|
+
Project-URL: Changelog, https://github.com/ashvardanian/tinysemver/blob/main/CHANGELOG.md
|
|
208
213
|
Classifier: Development Status :: 4 - Beta
|
|
209
214
|
Classifier: Intended Audience :: Developers
|
|
210
215
|
Classifier: Topic :: Software Development :: Build Tools
|
|
@@ -234,21 +239,40 @@ $ tinysemver --dry-run --verbose
|
|
|
234
239
|
|
|
235
240
|
The `--dry-run` flag will only print the next version without changing any files.
|
|
236
241
|
Great for pre-release CI pipelines.
|
|
237
|
-
If you need more control over the default specification, here are more options:
|
|
242
|
+
If you need more control over the default specification, here are more options you can run against the files in this repository:
|
|
238
243
|
|
|
239
244
|
```sh
|
|
245
|
+
# This won't push
|
|
240
246
|
$ tinysemver --verbose \
|
|
241
247
|
--major-verbs 'breaking,break,major' \
|
|
242
248
|
--minor-verbs 'feature,minor,add,new' \
|
|
243
249
|
--patch-verbs 'fix,patch,bug,improve' \
|
|
244
250
|
--changelog-file 'CHANGELOG.md' \
|
|
245
251
|
--version-file 'VERSION' \
|
|
252
|
+
--update-version-in 'pyproject.toml' '^version = "(\d+\.\d+\.\d+)"' \
|
|
253
|
+
--github-repository 'ashvardanian/tinysemver'
|
|
254
|
+
# Revert to the previous commit
|
|
255
|
+
$ git reset --soft HEAD~1
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
It's recommended to use strict version matching with `\d+\.\d+\.\d+` instead of a generic wildcard like `.*`, but both would work.
|
|
259
|
+
Here is an example of passing even more parameters for a project like `stringzilla`:
|
|
260
|
+
|
|
261
|
+
```sh
|
|
262
|
+
$ tinysemver --verbose \
|
|
263
|
+
--major-verbs 'breaking,break,major' \
|
|
264
|
+
--minor-verbs 'feature,minor,add,new' \
|
|
265
|
+
--patch-verbs 'fix,patch,bug,improve' \
|
|
266
|
+
--changelog-file 'CHANGELOG.md' \
|
|
267
|
+
--version-file 'VERSION' \
|
|
268
|
+
--update-version-in 'pyproject.toml' '^version = "(\d+\.\d+\.\d+)"' \
|
|
246
269
|
--update-version-in 'package.json' '"version": "(.*)"' \
|
|
247
270
|
--update-version-in 'CITATION.cff' '^version: (.*)' \
|
|
248
271
|
--update-major-version-in 'include/stringzilla/stringzilla.h' '^#define STRINGZILLA_VERSION_MAJOR (.*)' \
|
|
249
272
|
--update-minor-version-in 'include/stringzilla/stringzilla.h' '^#define STRINGZILLA_VERSION_MINOR (.*)' \
|
|
250
273
|
--update-patch-version-in 'include/stringzilla/stringzilla.h' '^#define STRINGZILLA_VERSION_PATCH (.*)' \
|
|
251
|
-
--github-repository 'ashvardanian/stringzilla'
|
|
274
|
+
--github-repository 'ashvardanian/stringzilla' \
|
|
275
|
+
--push
|
|
252
276
|
> Current version: 1.2.2
|
|
253
277
|
> ? Commits since last tag: 3 # Only in verbose mode
|
|
254
278
|
> # 5579972: Improve: Log file patches # Only in verbose mode
|
|
@@ -260,6 +284,9 @@ $ tinysemver --verbose \
|
|
|
260
284
|
> Will update file: package.json:5
|
|
261
285
|
> - "version": "1.2.2" # Only in verbose mode
|
|
262
286
|
> + "version": "1.3.0" # Only in verbose mode
|
|
287
|
+
> Will update file: pyproject.toml:7
|
|
288
|
+
> - version = "1.2.2" # Only in verbose mode
|
|
289
|
+
> + version = "1.3.0" # Only in verbose mode
|
|
263
290
|
> Will update file: CITATION.cff:7
|
|
264
291
|
> - version: 1.2.2 # Only in verbose mode
|
|
265
292
|
> + version: 1.3.0 # Only in verbose mode
|
|
@@ -274,6 +301,66 @@ Alternatively, you can just ask for `--help`:
|
|
|
274
301
|
$ tinysemver --help
|
|
275
302
|
```
|
|
276
303
|
|
|
304
|
+
## Use the Action
|
|
305
|
+
|
|
306
|
+
```yaml
|
|
307
|
+
name: CI
|
|
308
|
+
|
|
309
|
+
on:
|
|
310
|
+
push:
|
|
311
|
+
branches: [ main ]
|
|
312
|
+
|
|
313
|
+
jobs:
|
|
314
|
+
build:
|
|
315
|
+
# Add this condition to skip recursive releases
|
|
316
|
+
if: "!contains(github.event.head_commit.message, 'Release:')"
|
|
317
|
+
runs-on: ubuntu-latest
|
|
318
|
+
|
|
319
|
+
steps:
|
|
320
|
+
- uses: actions/checkout@v4
|
|
321
|
+
with:
|
|
322
|
+
persist-credentials: false # only if main branch if protected
|
|
323
|
+
# Your existing steps...
|
|
324
|
+
|
|
325
|
+
- name: Run TinySemVer
|
|
326
|
+
uses: your-username/tinysemver@v1
|
|
327
|
+
with:
|
|
328
|
+
dry-run: 'true'
|
|
329
|
+
verbose: 'true'
|
|
330
|
+
push: 'true'
|
|
331
|
+
major-verbs: 'breaking,break,major'
|
|
332
|
+
minor-verbs: 'feature,minor,add,new'
|
|
333
|
+
patch-verbs: 'fix,patch,bug,improve,docs'
|
|
334
|
+
changelog-file: 'CHANGELOG.md'
|
|
335
|
+
version-file: 'VERSION'
|
|
336
|
+
update-version-in: 'pyproject.toml,version = "(.*)"'
|
|
337
|
+
git-user-name: 'GitHub Actions'
|
|
338
|
+
git-user-email: 'actions@github.com'
|
|
339
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
340
|
+
create-release: 'true'
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
### Security Considerations for Protected Branches
|
|
344
|
+
|
|
345
|
+
If your default branch is protected with a "pull request before merging" rule:
|
|
346
|
+
|
|
347
|
+
1. A repository-scoped Personal Access Token (PAT) is required to push to the branch.
|
|
348
|
+
2. Set `persist-credentials: false` in the `actions/checkout` step.
|
|
349
|
+
|
|
350
|
+
⚠️ **Important Security Note:**
|
|
351
|
+
- The default `GITHUB_TOKEN` cannot be used with protected branches.
|
|
352
|
+
- Using a PAT instead of `GITHUB_TOKEN` poses security risks:
|
|
353
|
+
- Workflows from any branch can access secret variables.
|
|
354
|
+
- This could allow non-protected branches to use elevated permissions.
|
|
355
|
+
- Mitigation:
|
|
356
|
+
- Use a fine-grained PAT with minimal necessary permissions.
|
|
357
|
+
- Prefer the `pull_request` workflow trigger, which limits permissions.
|
|
358
|
+
- Be cautious: users with write access could still potentially exploit workflows to expose the PAT.
|
|
359
|
+
|
|
360
|
+
Always follow the principle of least privilege when setting up tokens and permissions.
|
|
361
|
+
|
|
362
|
+
For more information on CI configurations and pushing changes in GitHub Actions, see the [semantic-release GitHub Actions guide](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/ci-configurations/github-actions.md#pushing-packagejson-changes-to-a-master-branch).
|
|
363
|
+
|
|
277
364
|
## Why?
|
|
278
365
|
|
|
279
366
|
In the past I was using [semantic-release](https://github.com/semantic-release/semantic-release) for my 10+ projects.
|
|
@@ -378,24 +465,24 @@ Probably very useful for 2-3 projects, I didn't need to support any of them yet.
|
|
|
378
465
|
## Examples
|
|
379
466
|
|
|
380
467
|
Assembling RegEx queries can be hard.
|
|
381
|
-
Luckily, there aren't too
|
|
468
|
+
Luckily, there aren't too many files to update in most projects.
|
|
382
469
|
Below is an example of a pipeline for the USearch project, that has bindings to 10 programming languages.
|
|
383
470
|
Feel free to add other sources and examples.
|
|
384
471
|
|
|
385
472
|
```sh
|
|
386
473
|
$ mkdir -p example
|
|
387
474
|
|
|
388
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/VERSION -
|
|
389
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/CHANGELOG.md -
|
|
390
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/CITATION.cff -
|
|
391
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/CMakeLists.txt -
|
|
392
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/Cargo.toml -
|
|
393
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/package.json -
|
|
394
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/conanfile.py -
|
|
395
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/README.md -
|
|
396
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/wasmer.toml -
|
|
397
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/csharp/nuget/nuget-package.props -
|
|
398
|
-
$ wget https://github.com/unum-cloud/usearch/raw/main/include/usearch/index.hpp -
|
|
475
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/VERSION -P example/
|
|
476
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/CHANGELOG.md -P example/ # Missing
|
|
477
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/CITATION.cff -P example/
|
|
478
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/CMakeLists.txt -P example/
|
|
479
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/Cargo.toml -P example/
|
|
480
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/package.json -P example/
|
|
481
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/conanfile.py -P example/
|
|
482
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/README.md -P example/
|
|
483
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/wasmer.toml -P example/
|
|
484
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/csharp/nuget/nuget-package.props -P example/
|
|
485
|
+
$ wget https://github.com/unum-cloud/usearch/raw/main/include/usearch/index.hpp -P example/
|
|
399
486
|
|
|
400
487
|
# You can match the semantic version part with a generic wildcard like: .*
|
|
401
488
|
# But it's recommended to stick to a stricter format: \d+\.\d+\.\d+
|
|
@@ -413,8 +500,21 @@ $ tinysemver --dry-run --verbose \
|
|
|
413
500
|
--update-version-in 'example/README.md' '^version = \{(\d+\.\d+\.\d+)\}' \
|
|
414
501
|
--update-version-in 'example/wasmer.toml' '^version = "(\d+\.\d+\.\d+)"' \
|
|
415
502
|
--update-version-in 'example/nuget-package.props' '(\d+\.\d+\.\d+)\<\/Version\>' \
|
|
416
|
-
--update-major-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MAJOR (\d)' \
|
|
417
|
-
--update-minor-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MINOR (\d)' \
|
|
418
|
-
--update-patch-version-in 'example/index.hpp' '^#define USEARCH_VERSION_PATCH (\d)' \
|
|
503
|
+
--update-major-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MAJOR (\d+)' \
|
|
504
|
+
--update-minor-version-in 'example/index.hpp' '^#define USEARCH_VERSION_MINOR (\d+)' \
|
|
505
|
+
--update-patch-version-in 'example/index.hpp' '^#define USEARCH_VERSION_PATCH (\d+)' \
|
|
419
506
|
--path .
|
|
420
507
|
```
|
|
508
|
+
|
|
509
|
+
## Contributing
|
|
510
|
+
|
|
511
|
+
Feel free to open an issue or a pull request.
|
|
512
|
+
If you need to bump the version of `tinysemver` itself:
|
|
513
|
+
|
|
514
|
+
```sh
|
|
515
|
+
tinysemver --verbose \
|
|
516
|
+
--version-file 'VERSION' \
|
|
517
|
+
--changelog-file 'CHANGELOG.md' \
|
|
518
|
+
--update-version-in 'pyproject.toml' 'version = "(.*)"' \
|
|
519
|
+
--github-repository 'ashvardanian/tinysemver' --push
|
|
520
|
+
```
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|