commit-and-tag-version 12.7.0 → 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.
@@ -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@v4
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@v5
37
+ uses: codecov/codecov-action@v6
38
38
  with:
39
39
  env_vars: OS, NODE_VERSION
@@ -4,11 +4,17 @@ on:
4
4
  branches:
5
5
  - master
6
6
  name: release-please
7
+
8
+ permissions:
9
+ id-token: write # Required for OIDC
10
+ contents: write
11
+ issues: write
12
+ pull-requests: write
7
13
  jobs:
8
14
  release-please:
9
15
  runs-on: ubuntu-latest
10
16
  steps:
11
- - uses: GoogleCloudPlatform/release-please-action@v4
17
+ - uses: GoogleCloudPlatform/release-please-action@v5
12
18
  id: release
13
19
  with:
14
20
  token: ${{ secrets.GITHUB_TOKEN }}
@@ -19,14 +25,14 @@ jobs:
19
25
  # these if statements ensure that a publication only occurs when
20
26
  # a new release is created:
21
27
  if: ${{ steps.release.outputs.release_created }}
22
- - uses: actions/setup-node@v4
28
+ - uses: actions/setup-node@v6
23
29
  with:
24
- node-version: 20
30
+ node-version: 22
25
31
  registry-url: 'https://registry.npmjs.org'
26
32
  if: ${{ steps.release.outputs.release_created }}
33
+ - run: npm install -g npm@latest
34
+ if: ${{ steps.release.outputs.release_created }}
27
35
  - run: npm ci
28
36
  if: ${{ steps.release.outputs.release_created }}
29
- - run: npm publish
30
- env:
31
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
37
+ - run: npm publish --provenance
32
38
  if: ${{ steps.release.outputs.release_created }}
package/CHANGELOG.md CHANGED
@@ -2,6 +2,27 @@
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
+
19
+ ## [12.7.1](https://github.com/absolute-version/commit-and-tag-version/compare/v12.7.0...v12.7.1) (2026-03-18)
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * 🐛 updating dependency fast-xml-parser ([#277](https://github.com/absolute-version/commit-and-tag-version/issues/277)) ([dac372b](https://github.com/absolute-version/commit-and-tag-version/commit/dac372bfa8b8b124a1e9a8760074a86a641476f9))
25
+
5
26
  ## [12.7.0](https://github.com/absolute-version/commit-and-tag-version/compare/v12.6.1...v12.7.0) (2026-03-17)
6
27
 
7
28
 
@@ -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({ format: true });
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.0",
3
+ "version": "12.7.3",
4
4
  "description": "replacement for `npm version` with automatic CHANGELOG generation",
5
- "bin": "bin/cli.js",
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": "absolute-version/commit-and-tag-version",
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
  },
@@ -47,7 +52,7 @@
47
52
  "detect-indent": "^6.1.0",
48
53
  "detect-newline": "^3.1.0",
49
54
  "dotgitignore": "^2.1.0",
50
- "fast-xml-parser": "^5.3.4",
55
+ "fast-xml-parser": "^5.5.6",
51
56
  "figures": "^3.2.0",
52
57
  "find-up": "^5.0.0",
53
58
  "git-semver-tags": "^5.0.1",
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
+