Skip to main content

Git Version

npm version CLI Command

To update the version value of the package.json file from the terminal, you can use the npm version command. This command automatically updates the version field in package.json, tags the version in git, and creates a version commit.

Here's how you can use it:

  • Patch Version (0.0.x): Increments the patch version.

    npm version patch
  • Minor Version (0.x.0): Increments the minor version.

    npm version minor
  • Major Version (x.0.0): Increments the major version.

    npm version major

If you need to set a specific version, you can run:

npm version <specific-version>

For example, to set the version to 1.2.3, you would run:

npm version 1.2.3

These commands not only update the package.json but also create a commit and a git tag with the new version by default. If you do not want to create a git tag, you can add the --no-git-tag-version flag:

npm version 1.2.3 --no-git-tag-version

Please ensure that you have git initialized in your repository to take advantage of the default tagging and committing feature.

Git Tagging

Viewing and Removing Tags

git tag -l # lists all tags
git tag -d 13.0.0 # removes the tag
git tag list # creates a new tag called `list`; DO NOT DO THIS

Release Tags (Automated)

The setup:

"release": "yarn nx:build && nx release  --first-release=true --dry-run=true --verbose",
"version": "1.0.1", # packages/github-motion/package.json
yarn release # builds, versions, CHANGELOG.md, and commits

The output:

yarn release --dry-run=false
Debugger listening on ws://127.0.0.1:54443/645c0a96-fc44-49cc-a650-c1bf150693f0
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
yarn run v1.22.22
$ yarn nx:build && nx release --first-release=true --dry-run=true --verbose --dry-run=false
Debugger listening on ws://127.0.0.1:54447/659dafa2-aa2f-43a7-84dc-e965303ab640
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
$ nx run-many --target=build --with-deps=true --skip-nx-cache=true --clean=true --verbose
Debugger listening on ws://127.0.0.1:54449/f8ab142b-0c77-44bb-afc2-fbe962485413
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
[NX CLOUD] Verifying current cloud bundle
[NX CLOUD] A local bundle currently exists: {
version: '2412.18.5.hotfix5',
fullPath: '/Users/valencia/work/github/buildmotion-github-motion-poc/.nx/cache/cloud/2412.18.5.hotfix5'
}
[NX CLOUD] Last verification was within the past 30 minutes, will not verify this time
[NX CLOUD] Done: /Users/valencia/work/github/buildmotion-github-motion-poc/.nx/cache/cloud/2412.18.5.hotfix5

NX --skip-nx-cache disables the connection to Nx Cloud for the current run.

The remote cache will not be read from or written to during this run.


NX Running target build for project github-motion:

- github-motion

With additional flags:
--with-deps=true
--clean=true

——————————————————————————————————————————————————————————————————————————————————————————————————————————

> nx run github-motion:build --with-deps=true --clean=true

Debugger listening on ws://127.0.0.1:54454/d8689ff6-ecec-4a48-a603-434c6d2f2211
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Compiling TypeScript files for project "github-motion"...
Done compiling TypeScript files for project "github-motion".
Waiting for the debugger to disconnect...

——————————————————————————————————————————————————————————————————————————————————————————————————————————

NX Successfully ran target build for project github-motion


Debugger listening on ws://127.0.0.1:54459/1137a893-83c3-4116-a330-19884d1afdf6
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
Waiting for the debugger to disconnect...
Waiting for the debugger to disconnect...
Debugger listening on ws://127.0.0.1:54462/743508de-d2c3-4f74-aacf-2ebef57de88f
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

NX Running release version for project: github-motion

github-motion 🔍 Reading data for package "@buildmotion/github-motion" from packages/github-motion/package.json
github-motion 📄 Unable to resolve the current version from git tag using pattern "{version}". Falling back to the version on disk of 1.0.1
github-motion 📄 Resolved the specifier as "major" using git history and the conventional commits standard.
github-motion ✍️ New version 2.0.0 written to packages/github-motion/package.json

UPDATE packages/github-motion/package.json

"name": "@buildmotion/github-motion",
- "version": "1.0.1",
+ "version": "2.0.0",
"dependencies": {


Skipped lock file update because skipLockFileUpdate was set.

NX Staging changed files with git

Staging files in git with the following command:
git add packages/github-motion/package.json
Determined workspace --from ref from the first commit in the workspace: f6a4488ef5fe9bded89df114fe6416510f62fbf4

NX Generating an entry in CHANGELOG.md for 2.0.0


NOTE: There was no diff detected for the changelog entry. Maybe you intended to pass alternative git references via --from and --to?
Determined release group --from ref from the first commit in the workspace: f6a4488ef5fe9bded89df114fe6416510f62fbf4

NX Generating an entry in packages/github-motion/CHANGELOG.md for 2.0.0


CREATE packages/github-motion/CHANGELOG.md
+ # 2.0.0 (2025-01-02)
+
+
+ ### 🚀 Features
+
+ - **plugin:** Add github-motion plugin project ([13fda03](https://github.com/buildmotion/github-motion-poc/commit/13fda03))
+
+ - **plugin:** Add github-repository project (initial) ([974f121](https://github.com/buildmotion/github-motion-poc/commit/974f121))
+
+ - **github-motion:** Add URL option for Git repository ([5c96e7d](https://github.com/buildmotion/github-motion-poc/commit/5c96e7d))
+
+ - **ci:** update publish configuration ([c64d591](https://github.com/buildmotion/github-motion-poc/commit/c64d591))
+
+ ### 🩹 Fixes
+
+ - update executor.ts ([38ed57a](https://github.com/buildmotion/github-motion-poc/commit/38ed57a))
+
+ - executor.ts ([cf04e91](https://github.com/buildmotion/github-motion-poc/commit/cf04e91))
+
+ - update executor.ts ([3f3ac10](https://github.com/buildmotion/github-motion-poc/commit/3f3ac10))
+
+ - update executor.ts ([e635c26](https://github.com/buildmotion/github-motion-poc/commit/e635c26))
+
+
+
+ ### ⚠️ Breaking Changes
+
+ - **nx:** release process configuration updated
+ - **nx:** release process configuration updated
+ - ⚠️ **nx:** update nx.release config 3 ([d8c71dd](https://github.com/buildmotion/github-motion-poc/commit/d8c71dd))
+ - **nx:** 13
+ - **nx:** 14
+ - **nx:** 15
+
+ ### ❤️ Thank You
+
+ - Matt Vaughn @buildmotion


NX Staging changed files with git

Staging files in git with the following command:
git add packages/github-motion/CHANGELOG.md

NX Committing changes with git

Committing files in git with the following command:
git commit --message chore(release): publish 2.0.0

NX Tagging commit with git

Tagging the current commit in git with the following command:
git tag --annotate 2.0.0 --message 2.0.0

NX Pushing to git remote

Pushing the current branch to the remote with the following command:
git push --follow-tags --no-verify --atomic

NX Creating GitHub Release

CREATE https://github.com/buildmotion/github-motion-poc/releases/tag/2.0.0

+ # 2.0.0 (2025-01-02)
+
+
+ ### 🚀 Features
+
+ - **3:** attempt 3; version config ([5429a89](https://github.com/buildmotion/github-motion-poc/commit/5429a89))
+ - **ci:** update publish configuration ([c64d591](https://github.com/buildmotion/github-motion-poc/commit/c64d591))
+ - **github-motion:** Add URL option for Git repository ([5c96e7d](https://github.com/buildmotion/github-motion-poc/commit/5c96e7d))
+ - **github-motion:** retrieve repo information with spec/integration tests ([a413e60](https://github.com/buildmotion/github-motion-poc/commit/a413e60))
+ - ⚠️ **nx:** simplify release config ([0cdd765](https://github.com/buildmotion/github-motion-poc/commit/0cdd765))
+
+ ### 🩹 Fixes
+
+ - update executor.ts ([38ed57a](https://github.com/buildmotion/github-motion-poc/commit/38ed57a))
+ - executor.ts ([cf04e91](https://github.com/buildmotion/github-motion-poc/commit/cf04e91))
+ - update executor.ts ([3f3ac10](https://github.com/buildmotion/github-motion-poc/commit/3f3ac10))
+ - update executor.ts ([e635c26](https://github.com/buildmotion/github-motion-poc/commit/e635c26))
+ - update executor.ts ([5a536bd](https://github.com/buildmotion/github-motion-poc/commit/5a536bd))
+ - update executor.integration.spec.ts ([6572eb2](https://github.com/buildmotion/github-motion-poc/commit/6572eb2))
+ - **ci:** add working directory to workflow; fixes #3 ([#3](https://github.com/buildmotion/github-motion-poc/issues/3))
+ - **docs:** update config to log broken links; fixes #7 ([#7](https://github.com/buildmotion/github-motion-poc/issues/7))
+
+ ### ⚠️ Breaking Changes
+
+ - **nx:** release process configuration updated
+ - ⚠️ **nx:** update nx.release config 3 ([d8c71dd](https://github.com/buildmotion/github-motion-poc/commit/d8c71dd))
+ - **nx:** 13
+ - **nx:** 14
+ - **nx:** 15
+ - ⚠️ **nx:** update nx.release config ([d6e1201](https://github.com/buildmotion/github-motion-poc/commit/d6e1201))
+ - ⚠️ **nx:** update nx.release config 2 ([94c4072](https://github.com/buildmotion/github-motion-poc/commit/94c4072))
+
+ ### ❤️ Thank You
+
+ - Matt Vaughn @buildmotion

✔ Do you want to publish these versions? (y/N) · true
[NX CLOUD] Verifying current cloud bundle
[NX CLOUD] A local bundle currently exists: {
version: '2412.18.5.hotfix5',
fullPath: '/Users/valencia/work/github/buildmotion-github-motion-poc/.nx/cache/cloud/2412.18.5.hotfix5'
}
[NX CLOUD] Last verification was within the past 30 minutes, will not verify this time
[NX CLOUD] Done: /Users/valencia/work/github/buildmotion-github-motion-poc/.nx/cache/cloud/2412.18.5.hotfix5

NX Running target nx-release-publish for project github-motion:

- github-motion

With additional flags:
--firstRelease=true

——————————————————————————————————————————————————————————————————————————————————————————————————————————
[Nx Cloud Debug] Attempting to acquire filesystem lock with path: /var/folders/r5/1trjjx6939zdgn94wv_gv7tm0000gn/T/client-instance-id.lock
[Nx Cloud Debug] Failed to create folder lock at path: /var/folders/r5/1trjjx6939zdgn94wv_gv7tm0000gn/T/client-instance-id.lock
[Nx Cloud] Unable to detect a VCS context from the environment.

NX RunStart


{
"meta": {},
"branch": null,
"runGroup": "39d6e4cf0626c159641e14ccc2cb29cf4f63763c",
"ciExecutionId": null,
"ciExecutionEnv": "",
"hashes": [
"15675579717984814546"
],
"machineInfo": {
"machineId": "3OeIVTYRErdeo7I4W9L3Lg==",
"platform": "darwin",
"version": "Darwin Kernel Version 24.1.0: Thu Oct 10 21:05:14 PDT 2024; root:xnu-11215.41.3~2/RELEASE_ARM64_T8103",
"cpuCores": 8
},
"vcsContext": null,
"clientInstanceSource": "CLOUD_RUNNER",
"clientInstanceId": "ac711aac-0076-4ba3-a8d6-3bafe161359f"
}

RunStart duration: 106

> nx run github-motion:nx-release-publish

Debugger listening on ws://127.0.0.1:54617/5b29e3fe-ae7c-43e8-a0e4-56c5d38333cb
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Skipped npm view because --first-release was set

📦 @buildmotion/github-motion@1.0.1
=== Tarball Contents ===

261B README.md
275B executors.json
288B package.json
209B src/executors/github-repository/executor.d.ts
1.5kB src/executors/github-repository/executor.js
1.5kB src/executors/github-repository/executor.js.map
3.3kB src/executors/github-repository/models/repo-info.model.d.ts
2.3kB src/executors/github-repository/models/repo-info.model.js
2.2kB src/executors/github-repository/models/repo-info.model.js.map
77B src/executors/github-repository/schema.d.ts
384B src/executors/github-repository/schema.json
113B src/index.d.ts
137B src/index.js
195B src/index.js.map
=== Tarball Details ===
name: @buildmotion/github-motion
version: 1.0.1
filename: buildmotion-github-motion-1.0.1.tgz
package size: 4.1 kB
unpacked size: 12.8 kB
shasum: e5cc5f428ff0a47cd5efedd2f44c37e2c588b9a9
integrity: sha512-a/qUUYxPRQoVZ[...]MtywdwKsxP98A==
total files: 14

Published to https://npm.pkg.github.com with tag "next"
Waiting for the debugger to disconnect...

——————————————————————————————————————————————————————————————————————————————————————————————————————————

NX Successfully ran target nx-release-publish for project github-motion



NX Storing terminal outputs for github-motion:nx-release-publish with hash 15675579717984814546

View logs and investigate cache misses at https://nx.app/runs/0Nzhaup2Iq

Debugger listening on ws://127.0.0.1:54627/2e3c1602-4f14-4b1a-82d2-08dec82222c8
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Waiting for the debugger to disconnect...
Waiting for the debugger to disconnect...
✨ Done in 81.12s.