commit-and-tag-version 12.7.1 → 12.7.3
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.
- package/.github/workflows/ci.yaml +2 -2
- package/.github/workflows/release-please.yml +6 -4
- package/CHANGELOG.md +14 -0
- package/lib/updaters/types/maven.js +15 -2
- package/package.json +8 -3
- package/test/core.spec.js +34 -0
- package/test/mocks/pom-6.3.1-attrs-lf.xml +27 -0
- package/test/mocks/pom-6.4.0-attrs-lf.xml +28 -0
|
@@ -27,13 +27,13 @@ jobs:
|
|
|
27
27
|
- run: git fetch --prune --unshallow
|
|
28
28
|
- run: git config --global user.name 'Actions'
|
|
29
29
|
- run: git config --global user.email 'dummy@example.org'
|
|
30
|
-
- uses: actions/setup-node@
|
|
30
|
+
- uses: actions/setup-node@v6
|
|
31
31
|
with:
|
|
32
32
|
node-version: ${{ matrix.node }}
|
|
33
33
|
- run: node --version
|
|
34
34
|
- run: npm install --engine-strict
|
|
35
35
|
- run: npm test
|
|
36
36
|
- name: Codecov
|
|
37
|
-
uses: codecov/codecov-action@
|
|
37
|
+
uses: codecov/codecov-action@v6
|
|
38
38
|
with:
|
|
39
39
|
env_vars: OS, NODE_VERSION
|
|
@@ -14,7 +14,7 @@ jobs:
|
|
|
14
14
|
release-please:
|
|
15
15
|
runs-on: ubuntu-latest
|
|
16
16
|
steps:
|
|
17
|
-
- uses: GoogleCloudPlatform/release-please-action@
|
|
17
|
+
- uses: GoogleCloudPlatform/release-please-action@v5
|
|
18
18
|
id: release
|
|
19
19
|
with:
|
|
20
20
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -25,12 +25,14 @@ jobs:
|
|
|
25
25
|
# these if statements ensure that a publication only occurs when
|
|
26
26
|
# a new release is created:
|
|
27
27
|
if: ${{ steps.release.outputs.release_created }}
|
|
28
|
-
- uses: actions/setup-node@
|
|
28
|
+
- uses: actions/setup-node@v6
|
|
29
29
|
with:
|
|
30
|
-
node-version:
|
|
30
|
+
node-version: 22
|
|
31
31
|
registry-url: 'https://registry.npmjs.org'
|
|
32
32
|
if: ${{ steps.release.outputs.release_created }}
|
|
33
|
+
- run: npm install -g npm@latest
|
|
34
|
+
if: ${{ steps.release.outputs.release_created }}
|
|
33
35
|
- run: npm ci
|
|
34
36
|
if: ${{ steps.release.outputs.release_created }}
|
|
35
|
-
- run: npm publish
|
|
37
|
+
- run: npm publish --provenance
|
|
36
38
|
if: ${{ steps.release.outputs.release_created }}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [12.7.3](https://github.com/absolute-version/commit-and-tag-version/compare/v12.7.2...v12.7.3) (2026-03-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* update release workflow for npm OIDC trusted publishing ([#281](https://github.com/absolute-version/commit-and-tag-version/issues/281)) ([d0e3408](https://github.com/absolute-version/commit-and-tag-version/commit/d0e3408a17ad9e20ab2e7d9b187d0a22da012cf7))
|
|
11
|
+
|
|
12
|
+
## [12.7.2](https://github.com/absolute-version/commit-and-tag-version/compare/v12.7.1...v12.7.2) (2026-03-18)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **maven:** Preserve XML attributes when updating pom.xml files ([#279](https://github.com/absolute-version/commit-and-tag-version/issues/279)) ([81b4f98](https://github.com/absolute-version/commit-and-tag-version/commit/81b4f98319b88793f406139aa102d17a422cb8de))
|
|
18
|
+
|
|
5
19
|
## [12.7.1](https://github.com/absolute-version/commit-and-tag-version/compare/v12.7.0...v12.7.1) (2026-03-18)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -5,7 +5,14 @@ const CRLF = '\r\n';
|
|
|
5
5
|
const LF = '\n';
|
|
6
6
|
|
|
7
7
|
function pomDocument(contents) {
|
|
8
|
-
const parser = new XMLParser(
|
|
8
|
+
const parser = new XMLParser({
|
|
9
|
+
// Preserve attributes on XML elements (fast-xml-parser strips them by default)
|
|
10
|
+
ignoreAttributes: false,
|
|
11
|
+
// Don't coerce element text to numbers/booleans (e.g. keep version "1.0" as a string)
|
|
12
|
+
parseTagValue: false,
|
|
13
|
+
// Don't coerce attribute values to numbers/booleans (e.g. keep port="8080" as a string)
|
|
14
|
+
parseAttributeValue: false,
|
|
15
|
+
});
|
|
9
16
|
return parser.parse(contents);
|
|
10
17
|
}
|
|
11
18
|
|
|
@@ -32,7 +39,13 @@ module.exports.writeVersion = function (contents, version) {
|
|
|
32
39
|
|
|
33
40
|
document.project.version = version;
|
|
34
41
|
|
|
35
|
-
const builder = new XMLBuilder({
|
|
42
|
+
const builder = new XMLBuilder({
|
|
43
|
+
// Preserve attributes on XML elements (fast-xml-parser strips them by default)
|
|
44
|
+
ignoreAttributes: false,
|
|
45
|
+
// Write fork="true" instead of shorthand fork (which is invalid in XML)
|
|
46
|
+
suppressBooleanAttributes: false,
|
|
47
|
+
format: true,
|
|
48
|
+
});
|
|
36
49
|
const xml = builder.build(document);
|
|
37
50
|
|
|
38
51
|
if (newline === CRLF) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "commit-and-tag-version",
|
|
3
|
-
"version": "12.7.
|
|
3
|
+
"version": "12.7.3",
|
|
4
4
|
"description": "replacement for `npm version` with automatic CHANGELOG generation",
|
|
5
|
-
"bin":
|
|
5
|
+
"bin": {
|
|
6
|
+
"commit-and-tag-version": "bin/cli.js"
|
|
7
|
+
},
|
|
6
8
|
"scripts": {
|
|
7
9
|
"lint": "eslint .",
|
|
8
10
|
"lint:fix": "npm run lint -- --fix",
|
|
@@ -15,7 +17,10 @@
|
|
|
15
17
|
"test:git-integration": "jest --testPathPattern test/git.integration-test.js",
|
|
16
18
|
"release": "bin/cli.js"
|
|
17
19
|
},
|
|
18
|
-
"repository":
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/absolute-version/commit-and-tag-version.git"
|
|
23
|
+
},
|
|
19
24
|
"engines": {
|
|
20
25
|
"node": ">=18"
|
|
21
26
|
},
|
package/test/core.spec.js
CHANGED
|
@@ -1409,6 +1409,40 @@ describe('cli', function () {
|
|
|
1409
1409
|
expect(calledWithContentStr).toEqual(expected);
|
|
1410
1410
|
});
|
|
1411
1411
|
|
|
1412
|
+
it('bumps version in Maven `pom.xml` file preserving XML attributes', async function () {
|
|
1413
|
+
const expected = fs.readFileSync(
|
|
1414
|
+
'./test/mocks/pom-6.4.0-attrs-lf.xml',
|
|
1415
|
+
'utf-8',
|
|
1416
|
+
);
|
|
1417
|
+
const filename = 'pom.xml';
|
|
1418
|
+
mock({
|
|
1419
|
+
bump: 'minor',
|
|
1420
|
+
realTestFiles: [
|
|
1421
|
+
{
|
|
1422
|
+
filename,
|
|
1423
|
+
path: './test/mocks/pom-6.3.1-attrs-lf.xml',
|
|
1424
|
+
},
|
|
1425
|
+
],
|
|
1426
|
+
});
|
|
1427
|
+
await exec({
|
|
1428
|
+
packageFiles: [{ filename, type: 'maven' }],
|
|
1429
|
+
bumpFiles: [{ filename, type: 'maven' }],
|
|
1430
|
+
});
|
|
1431
|
+
|
|
1432
|
+
// filePath is the first arg passed to writeFileSync
|
|
1433
|
+
const packageJsonWriteFileSynchCall = findWriteFileCallForPath({
|
|
1434
|
+
writeFileSyncSpy,
|
|
1435
|
+
filename,
|
|
1436
|
+
});
|
|
1437
|
+
|
|
1438
|
+
if (!packageJsonWriteFileSynchCall) {
|
|
1439
|
+
throw new Error(`writeFileSynch not invoked with path ${filename}`);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
const calledWithContentStr = packageJsonWriteFileSynchCall[1];
|
|
1443
|
+
expect(calledWithContentStr).toEqual(expected);
|
|
1444
|
+
});
|
|
1445
|
+
|
|
1412
1446
|
it('bumps version in Gradle `build.gradle.kts` file', async function () {
|
|
1413
1447
|
const expected = fs.readFileSync(
|
|
1414
1448
|
'./test/mocks/build-6.4.0.gradle.kts',
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
2
|
+
<modelVersion>4.0.0</modelVersion>
|
|
3
|
+
<groupId>com.mycompany.app</groupId>
|
|
4
|
+
<artifactId>my-module</artifactId>
|
|
5
|
+
<version>6.3.1</version>
|
|
6
|
+
<build>
|
|
7
|
+
<plugins>
|
|
8
|
+
<plugin>
|
|
9
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
10
|
+
<artifactId>maven-antrun-plugin</artifactId>
|
|
11
|
+
<executions>
|
|
12
|
+
<execution>
|
|
13
|
+
<id>ktlint</id>
|
|
14
|
+
<configuration>
|
|
15
|
+
<target name="ktlint">
|
|
16
|
+
<java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true" classname="com.pinterest.ktlint.Main">
|
|
17
|
+
<classpath refid="maven.plugin.classpath"/>
|
|
18
|
+
<arg value="src/**/*.kt"/>
|
|
19
|
+
</java>
|
|
20
|
+
</target>
|
|
21
|
+
</configuration>
|
|
22
|
+
</execution>
|
|
23
|
+
</executions>
|
|
24
|
+
</plugin>
|
|
25
|
+
</plugins>
|
|
26
|
+
</build>
|
|
27
|
+
</project>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
2
|
+
<modelVersion>4.0.0</modelVersion>
|
|
3
|
+
<groupId>com.mycompany.app</groupId>
|
|
4
|
+
<artifactId>my-module</artifactId>
|
|
5
|
+
<version>6.4.0</version>
|
|
6
|
+
<build>
|
|
7
|
+
<plugins>
|
|
8
|
+
<plugin>
|
|
9
|
+
<groupId>org.apache.maven.plugins</groupId>
|
|
10
|
+
<artifactId>maven-antrun-plugin</artifactId>
|
|
11
|
+
<executions>
|
|
12
|
+
<execution>
|
|
13
|
+
<id>ktlint</id>
|
|
14
|
+
<configuration>
|
|
15
|
+
<target name="ktlint">
|
|
16
|
+
<java taskname="ktlint" dir="${project.basedir}" fork="true" failonerror="true" classname="com.pinterest.ktlint.Main">
|
|
17
|
+
<classpath refid="maven.plugin.classpath"></classpath>
|
|
18
|
+
<arg value="src/**/*.kt"></arg>
|
|
19
|
+
</java>
|
|
20
|
+
</target>
|
|
21
|
+
</configuration>
|
|
22
|
+
</execution>
|
|
23
|
+
</executions>
|
|
24
|
+
</plugin>
|
|
25
|
+
</plugins>
|
|
26
|
+
</build>
|
|
27
|
+
</project>
|
|
28
|
+
|