{"id":22865759,"url":"https://github.com/clemlesne/gitops-version","last_synced_at":"2025-06-11T23:03:21.367Z","repository":{"id":163226962,"uuid":"619487061","full_name":"clemlesne/gitops-version","owner":"clemlesne","description":"Single, releasable, SmVer, GitFlow / GitOps compatible versions. As simple as that.","archived":false,"fork":false,"pushed_at":"2023-07-16T13:45:35.000Z","size":26,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-07T16:55:32.902Z","etag":null,"topics":["devops","devops-tools","gitflow","gitops","gitops-toolkit","pipeline-tooling","version"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clemlesne.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-03-27T08:35:49.000Z","updated_at":"2024-10-03T01:54:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"6d643bde-e074-4ab8-9896-e0779e2292e6","html_url":"https://github.com/clemlesne/gitops-version","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/clemlesne/gitops-version","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemlesne%2Fgitops-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemlesne%2Fgitops-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemlesne%2Fgitops-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemlesne%2Fgitops-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clemlesne","download_url":"https://codeload.github.com/clemlesne/gitops-version/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clemlesne%2Fgitops-version/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259360728,"owners_count":22845817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["devops","devops-tools","gitflow","gitops","gitops-toolkit","pipeline-tooling","version"],"created_at":"2024-12-13T11:38:49.717Z","updated_at":"2025-06-11T23:03:21.361Z","avatar_url":"https://github.com/clemlesne.png","language":"PowerShell","readme":"# GitOps version\n\n- Generate a version from git tags and commits\n- Version is cached in a file to avoid expensive git operations\n- Schema is based on [semver](https://semver.org/)\n- Compatible with [gitflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow)\n- Portable, works on Linux and Windows\n\n## In a nutshell\n\nVersion are generated from git tags and commits. Format is \"[major].{minor}.[patch]-[commit amout since last tag].[commit id]+[timestamp]\".\n\nTimestamp is only added if the version is not cached. Timestamp is added to avoid integrity issues when executing the script multiple times.\n\n### Install to your repo\n\nLinux:\n\n```bash\n# Add this repo as a submodule, from the root of your repo\n❯ git submodule add -b master https://github.com/clemlesne/gitops-version cicd/version\n```\n\nIn GitHub, [Dependabot](https://github.com/dependabot) can automatically create you pull requests for new versions:\n\n```yaml\n# .github/dependabot.yml\nversion: 2\nupdates:\n  - package-ecosystem: gitsubmodule\n    schedule:\n        interval: daily\n    directory: cicd/version\n```\n\n### How to use\n\n```bash\n❯ sh version.sh -g .\n0.2.11-44.630dcd2\n```\n\n```powershell\n❯ .\\version.ps1 -g .\n0.2.11-44.630dcd2\n```\n\nExamples:\n\n```bash\n# Get short version from current commit\n❯ sh version.sh -g .\n0.2.11-44.630dcd2\n\n# Get long version from current commit\n❯ sh version.sh -g . -m\n0.2.11-44.630dcd2+20230327090732\n\n# Get the long cached version from commit\n❯ sh version.sh -g . -m -c\n0.2.11-44.630dcd2+20230327090732\n\n# Get the version from a repo stored in another folder\n❯ sh version.sh -g my_folder/\n0.7.2\n```\n\n## Advanced usage\n\n### [Makefile](https://www.gnu.org/software/make/manual/make.html)\n\nIn your `Makefile`:\n\n\u003c!-- markdownlint-disable no-hard-tabs --\u003e\n```makefile\nversion:\n\t@bash cicd/version/version.sh -g . -c\n\nversion-full:\n\t@bash cicd/version/version.sh -g . -c -m\n```\n\u003c!-- markdownlint-enable no-hard-tabs --\u003e\n\nAnd then, in your CI:\n\n```bash\n❯ make version-full\n0.7.3-21.00736a8+20230327092242\n```\n\n### [Gradle](https://gradle.org) (Java, Kotlin, Groovy, Scala, C/C++, JavaScript)\n\nIn your `build.gradle`:\n\n```groovy\nif (project.hasProperty('projVersion')) {\n  project.version = project.projVersion\n} else {\n  project.version = 'unknown'\n}\n```\n\nAnd then, in your CI:\n\n```bash\n# Build a Gradle project with the version\n❯ gradle -PprojVersion=$(sh version.sh -g . -m -c) build\n```\n\n## [Authors](./AUTHORS.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclemlesne%2Fgitops-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclemlesne%2Fgitops-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclemlesne%2Fgitops-version/lists"}