{"id":26164760,"url":"https://github.com/optum/semver-cli","last_synced_at":"2026-01-21T18:02:35.942Z","repository":{"id":154903946,"uuid":"630028791","full_name":"Optum/semver-cli","owner":"Optum","description":"A technology agnostic cli for common semantic versioning operations.","archived":false,"fork":false,"pushed_at":"2025-12-17T05:17:37.000Z","size":282,"stargazers_count":11,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-20T18:51:55.414Z","etag":null,"topics":["cli","deno","semver"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Optum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.txt","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-04-19T14:15:14.000Z","updated_at":"2025-11-10T13:59:35.000Z","dependencies_parsed_at":"2023-09-22T07:21:15.520Z","dependency_job_id":"a00917f3-8f27-460e-8bcf-325f3d277db0","html_url":"https://github.com/Optum/semver-cli","commit_stats":null,"previous_names":[],"tags_count":79,"template":false,"template_full_name":null,"purl":"pkg:github/Optum/semver-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Optum%2Fsemver-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Optum%2Fsemver-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Optum%2Fsemver-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Optum%2Fsemver-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Optum","download_url":"https://codeload.github.com/Optum/semver-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Optum%2Fsemver-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28638492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T17:36:33.271Z","status":"ssl_error","status_checked_at":"2026-01-21T17:36:30.617Z","response_time":86,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","deno","semver"],"created_at":"2025-03-11T15:40:11.729Z","updated_at":"2026-01-21T18:02:35.936Z","avatar_url":"https://github.com/Optum.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# About The Project\n\nA technology agnostic cli for common semantic versioning operations.\n\nBuilt with [Deno](https://deno.land/) 🦕\n\n# Installation\n\nBinaries can be found in the\n[Releases](https://github.com/Optum/semver-cli/releases) section. Get the\n[latest](https://github.com/Optum/semver-cli/releases/latest) or install from a\nsupported package manager below.\n\nInstalling from binaries or package manager does _not_ require the Deno runtime\nto also be installed.\n\n## Homebrew\n\n```sh\nbrew install optum/tap/semver\n```\n\nvia [optum](https://github.com/Optum/homebrew-tap)\n\n## From Source\n\nInstallation from source will require\n[Deno](https://deno.land/manual/getting_started/installation) to be installed.\n\n#### module\n\n```sh\ndeno install -gfA https://deno.land/x/semver_cli@0.9.13/main.ts -n semver\n```\n\n### git\n\n```sh\ngit clone https://github.com/optum/semver-cli.git\ncd semver-cli\ndeno task install\n```\n\n# Usage\n\n```sh\nsemver \u003ccommand\u003e\n\nCommands:\n  semver get                Get the version\n  semver set \u003cvalue\u003e        Set the version\n  semver inc                Increment the version\n  semver parse [value]      Parse the version and print\n  semver cmp \u003cv1\u003e \u003cv2\u003e      Compare v1 to v2 and return -1/0/1\n  semver gt \u003cv1\u003e \u003cv2\u003e       Return 0 if v1 is greater than v2, else 1\n  semver gte \u003cv1\u003e \u003cv2\u003e      Return 0 if v1 is greater than or equal to v2, else 1\n  semver lt \u003cv1\u003e \u003cv2\u003e       Return 0 if v1 is less than v2, else 1\n  semver lte \u003cv1\u003e \u003cv2\u003e      Return 0 if v1 is less than or equal to v2, else 1\n  semver eq \u003cv1\u003e \u003cv2\u003e       Return 0 if v1 is equal to v2, else 1\n  semver sort [versions..]  Sort semantic versions\n\nOptions:\n  --help     Show help                                                 [boolean]\n  --version  Show version number                                       [boolean]\n```\n\n### About\n\nThe `get`, `set` and `inc` commands operate against your working directory. They\nall operate against a `VERSION` file found in the root folder of your project.\n\nIf the `VERSION` file is not found the default version is `0.1.0`. The `inc`\ncommand will create the `VERSION` file if it doesn't already exist.\n\nThe `parse` command accepts a version string as input and parses and prints that\nversion as output if it is valid.\n\nThe `sort` command accepts one or more version strings and outputs them in\nsorted order (descending by default, one version per line). Use the `-a` flag\nfor ascending order, or read versions from stdin using `--`.\n\n#### examples\n\n```sh\n# No VERSION file\nsemver get # 0.1.0\n```\n\n```sh\n# Sets the VERSION file to 1.2.3 specifically\nsemver set 1.2.3  # 1.2.3\n```\n\n```sh\n# Gets the version and increments it, but does not update the VERSION file\nsemver get minor # 1.3.0\nsemver get # 1.2.3\n```\n\n```sh\n# parses a version string\nsemver parse 1.0.0 # {\"major\":1,\"minor\":1,\"patch\":0,\"prerelease\":[],\"build\":[]}\n```\n\n```sh\n# sort versions in descending order (default)\nsemver sort 2.0.0 1.0.0 3.0.0\n# 3.0.0\n# 2.0.0\n# 1.0.0\n```\n\n```sh\n# sort versions in ascending order\nsemver sort -a 2.0.0 1.0.0 3.0.0\n# 1.0.0\n# 2.0.0\n# 3.0.0\n```\n\n```sh\n# sort versions from stdin\ncat versions.txt | semver sort --\n# (sorted output)\n```\n\n### Incrementing\n\nWhen calling the command `inc` the `VERSION` file will be updated based on the\nsub command specified, `major`, `minor`, `patch`, `none`. Additional metadata\nmay be added to the version using the `--prerelease` and `--build` parameters.\n\nWhen incrementing with a prerelease label such as `--prerelease beta` then a\nprerelease number will be added or incremented automatically such as `beta.0`.\nIf the version is incremented again with `--prerelease beta` then it will\nincrement the number to `beta.1`. Switching the prerelease label which reset the\nnumber. `--prerelease alpha` will reset the number back to `alpha.0`.\n\n`none` can be used to synchronize new or out of sync files with post hooks, and\nalso it can be used in conjunction with `--prerelease` and `--build` without\nincrementing the main version numbers.\n\n#### examples\n\n```sh\nsemver set 1.2.3\nsemver inc none  # 1.2.3\nsemver inc patch # 1.2.4\nsemver inc minor # 1.3.0\nsemver inc major # 2.0.0\n```\n\n```sh\nsemver set 1.2.3-pre.0\nsemver inc --prerelease alpha # 1.2.3-alpha.0\nsemver inc --prerelease alpha # 1.2.3-alpha.1\nsemver inc --build 1          # 1.2.3-alpha.1+1\nsemver inc --prerelease beta  # 1.2.3-beta.0+1\n```\n\n### Increment Post Hooks\n\nIn addition to updating the `VERSION` file, semver can optionally update source\ncode files in your project. To configure the version command you can provide a\nconfiguration file at `.github/version.yml`.\n\nThere are a number of supported post hook kinds and a number of supported known\nproject kinds which make updating source code files easy.\n\n#### post hook kind\n\n| kind      | description                                                                 |\n| --------- | --------------------------------------------------------------------------- |\n| `replace` | replaced the previous version string with the next version string in a file |\n| `patch`   | supports auto-updating a set of well known file types (e.g. package.json)   |\n| `regexp`  | replaces matching string using a regexp                                     |\n\n#### patch file kinds\n\n| file kind      | description                                                                    |\n| -------------- | ------------------------------------------------------------------------------ |\n| `.csproj`      | Updates the `\u003cPropertyGroup\u003e\u003cVersion\u003e0.1.0\u003c/Version\u003e\u003c/PropertyGroup\u003e` element  |\n| `package.json` | Updates the `\"version\": \"0.1.0\"` of the `package.json` and `package-lock.json` |\n| `Chart.yaml`   | Updates the `version: 0.1.0` of the chart file                                 |\n| `pom.xml`      | Updates the `\u003cproject\u003e\u003cversion\u003e0.1.0\u003c/version\u003e\u003c/project\u003e` element              |\n\n\u003e If you would like another well known file type supported please file an issue\n\u003e or contribute a pull request. The `replace` or `regexp` post hook kinds are\n\u003e flexible in the meantime.\n\n#### example\n\n```yml\non:\n  post:\n    # Updates both package.json and package-lock.json\n    - kind: patch\n      file: package.json\n\n    # Uses non-matching groups to isolate the version to replace.\n    - kind: regexp\n      file: src/info.js\n      pattern: '^(?\u003c=export const version = \").*(?=\";)$'\n```\n\n## Actions\n\nThis repository has two actions available, either a basic setup action or a\nsingle docker based action.\n\n#### example\n\n```yml\nname: Publish\non:\n  workflow_dispatch:\n    inputs:\n      pre:\n        type: boolean\n        default: true\n  release:\n    types: [published]\n\njobs:\n  publish:\n    steps:\n      - if: ${{ inputs.pre || github.event.release.prerelease }}\n        name: Increment Pre-Release Version\n        uses: optum/semver-cli@1.0.9\n        with:\n          action: inc\n          prerelease: pre${{ github.run_number }}\n          build: ${{ github.run_id }}\n\n      - id: version\n        name: Get Version\n        uses: optum/semver-cli@1.0.9\n\n      - run: echo \"The calculated ${{ steps.version.outputs.version }}\"\n```\n\n#### example of setup action\n\n```yml\nname: Publish\non:\n  release:\n    types: [published]\n\njobs:\n  publish:\n    steps:\n      - name: Increment Pre-Release Version\n        uses: optum/semver-cli/setup@0.9.20\n\n      - id: version\n        name: Parse Version\n        run: |\n          VERSION=$(semver get)\n          echo \"version=$(echo $VERSION | jq -r '.version')\" \u003e $GITHUB_OUTPUT\n          echo \"major=$(echo $VERSION | jq -r '.major')\" \u003e $GITHUB_OUTPUT\n          echo \"minor=$(echo $VERSION | jq -r '.minor')\" \u003e $GITHUB_OUTPUT\n          echo \"patch=$(echo $VERSION | jq -r '.patch')\" \u003e $GITHUB_OUTPUT\n\n      - run: echo \"The calculated ${{ steps.version.outputs.version }}\"\n```\n\n# Contributing\n\nContributions are what make the open source community such an amazing place to\nlearn, inspire, and create. Any contributions you make are **greatly\nappreciated**.\n\nIf you have a suggestion that would make this better, please fork the repo and\ncreate a pull request. You can also simply open an issue with the tag\n\"enhancement\". Don't forget to give the project a star! Thanks again!\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## License\n\nDistributed under the Apache 2.0 License. See [`LICENSE`](./LICENSE) for more\ninformation.\n\n## Maintainers\n\n- Justin Chase\n  - GitHub Enterprise: [justinmchase](https://github.com/justinmchase)\n  - Email: justin.chase@optum.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptum%2Fsemver-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foptum%2Fsemver-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptum%2Fsemver-cli/lists"}