Skip to content

Commit 2d9ddfc

Browse files
committed
github release version added
1 parent 0bc392d commit 2d9ddfc

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ This change ensures that VSCode uses the "Ninja Multi-Config" generator by defau
358358
## [Software versioning](#)
359359
* [Semantic Versioning](docs/semantic_versioning.md)
360360
* [Getting Version From Git in CMake](docs/getting_version_from_git_in_CMake.md)
361+
* [Getting Release Version From Git (check for update)](docs/get_the_release_version_github.md)
362+
361363

362364
## [C++ Coding Standards and Style Guide](#)
363365
* [Goolge C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
To get the latest release version of a GitHub repository using `curl`, you can query the GitHub API. Here's how you can do it:
2+
3+
1. Open a terminal or command prompt.
4+
2. Run the following `curl` command, replacing `owner` with the repository owner's name and `repo` with the repository's name:
5+
6+
```bash
7+
curl --silent "https://api.github.com/repos/owner/repo/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
8+
```
9+
10+
### Explanation:
11+
- `https://api.github.com/repos/owner/repo/releases/latest`: This is the GitHub API endpoint for getting the latest release of a repository.
12+
- `grep '"tag_name":'`: Filters the response to show only the line that contains the release tag.
13+
- `sed -E 's/.*"([^"]+)".*/\1/'`: Extracts the version tag (the part inside double quotes after `"tag_name":`).
14+
15+
### Example:
16+
If you want to get the latest release of the repository `behnamasadi/cpp_tutorials`, you would run:
17+
18+
```bash
19+
curl --silent "https://api.github.com/repos/behnamasadi/cpp_tutorials/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
20+
```
21+
22+
for instance:
23+
24+
```
25+
curl --silent "https://api.github.com/repos/nerfstudio-project/gsplat/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
26+
```
27+
28+

0 commit comments

Comments
 (0)