{"id":16941170,"url":"https://github.com/greenpau/versioned","last_synced_at":"2026-03-04T17:02:24.987Z","repository":{"id":71914311,"uuid":"257602502","full_name":"greenpau/versioned","owner":"greenpau","description":"Simplified package metadata management for Go packages.","archived":false,"fork":false,"pushed_at":"2026-02-26T16:12:17.000Z","size":100,"stargazers_count":15,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-26T19:55:05.670Z","etag":null,"topics":["golang","sysadmin-tool","tools","versioning"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/greenpau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-04-21T13:21:16.000Z","updated_at":"2026-02-26T16:14:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"cc5d6b16-35be-42f3-bfcd-dc6363666b1d","html_url":"https://github.com/greenpau/versioned","commit_stats":{"total_commits":86,"total_committers":2,"mean_commits":43.0,"dds":"0.011627906976744207","last_synced_commit":"a0e63709ae3b66f14060dfb536386ce7fb394dcb"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/greenpau/versioned","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenpau%2Fversioned","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenpau%2Fversioned/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenpau%2Fversioned/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenpau%2Fversioned/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/greenpau","download_url":"https://codeload.github.com/greenpau/versioned/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/greenpau%2Fversioned/sbom","scorecard":{"id":444648,"data":{"date":"2025-08-11","repo":{"name":"github.com/greenpau/versioned","commit":"a0e63709ae3b66f14060dfb536386ce7fb394dcb"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/main.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/greenpau/versioned/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:29: update your workflow using https://app.stepsecurity.io/secureworkflow/greenpau/versioned/main.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:54: update your workflow using https://app.stepsecurity.io/secureworkflow/greenpau/versioned/main.yml/main?enable=pin","Info:   0 out of   3 GitHub-owned GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 7 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T06:23:31.343Z","repository_id":71914311,"created_at":"2025-08-19T06:23:31.343Z","updated_at":"2025-08-19T06:23:31.343Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30086516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T15:40:14.053Z","status":"ssl_error","status_checked_at":"2026-03-04T15:40:13.655Z","response_time":59,"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":["golang","sysadmin-tool","tools","versioning"],"created_at":"2024-10-13T21:08:52.775Z","updated_at":"2026-03-04T17:02:24.976Z","avatar_url":"https://github.com/greenpau.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# versioned\n\n\u003ca href=\"https://github.com/greenpau/versioned/actions/workflows/build.yml\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/greenpau/versioned/actions/workflows/build.yml/badge.svg\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pkg.go.dev/github.com/greenpau/versioned\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/godoc-reference-blue.svg\"\u003e\u003c/a\u003e\n![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)\n\nSimplified package metadata management for Go packages.\n\n* [Manage package metadata as part of your code](#package-metadata)\n* [Quickly increment major.minor.patch versions in `VERSION` file](#increment-majorminorpatch-versions)\n* [Keep version in `VERSION` file in sync with package version metadata](#package-metadata)\n* [Pass version, git branch/commit, build date/user metadata via `ldflags`](#package-metadata)\n\nThis repository contains:\n\n* `github.com/greenpau/versioned`: Go package (library)\n* `github.com/greenpau/versioned/cmd/versioned`: Command-line\n  package metadata management utility\n\n\u003c!-- begin-markdown-toc --\u003e\n## Table of Contents\n\n* [Getting Started](#getting-started)\n  * [Increment MAJOR.MINOR.PATCH Versions](#increment-majorminorpatch-versions)\n  * [Makefile Usage](#makefile-usage)\n* [Package Metadata](#package-metadata)\n  * [Golang](#golang)\n  * [Python](#python)\n  * [Node.js, Javascript, Typescript](#nodejs-javascript-typescript)\n  * [Blender Files](#blender-files)\n* [Markdown Table of Contents](#markdown-table-of-contents)\n* [License Header](#license-header)\n\n\u003c!-- end-markdown-toc --\u003e\n\n## Getting Started\n\nFirst, install `versioned`:\n\n```bash\ngo install github.com/greenpau/versioned/cmd/versioned@latest\n```\n\n### Increment MAJOR.MINOR.PATCH Versions\n\nBrowse to a repository and initialize `VERSION` file with `versioned`:\n\n```bash\nversioned -init\n```\n\nDisplay current version of the repo:\n\n```bash\nversioned\n```\n\nUpdate patch version in `VERSION` file:\n\n```bash\n$ versioned -patch\nincreased patch version by 1, current version: 1.0.1\nupdated version: 1.0.1, previous version: 1.0.0\n```\n\nDo the same operation silently:\n\n```bash\nversioned -patch -silent\n```\n\nUpdate minor version in `VERSION` file:\n\n```bash\nversioned -minor\n```\n\nUpdate major version in `VERSION` file:\n\n```bash\nversioned -major\n```\n\n### Makefile Usage\n\nAnother way of using `versioned` is adding the following\n`release` step in a `Makefile`:\n\n```\nAPP_NAME=\"myapp\"\nGIT_BRANCH:=$(shell git rev-parse --abbrev-ref HEAD -- | head -1)\n\nrelease:\n        @echo \"Making release\"\n        @if [ $(GIT_BRANCH) != \"master\" ]; then echo \"cannot release to non-master branch $(GIT_BRANCH)\" \u0026\u0026 false; fi\n        @git diff-index --quiet HEAD -- || ( echo \"git directory is dirty, commit changes first\" \u0026\u0026 false )\n        @versioned -patch\n        @git add VERSION\n        @git commit -m 'updated VERSION file'\n        @versioned -sync cmd/$(APP_NAME)/main.go\n        @echo \"Patched version\"\n        @git add cmd/$(APP_NAME)/main.go\n        @git commit -m \"released v`cat VERSION | head -1`\"\n        @git tag -a v`cat VERSION | head -1` -m \"v`cat VERSION | head -1`\"\n        @git push\n        @git push --tags\n        @echo \"If necessary, run the following commands:\"\n        @echo \"  git push --delete origin v$(APP_VERSION)\"\n        @echo \"  git tag --delete v$(APP_VERSION)\"\n```\n\n## Package Metadata\n\n### Golang\n\nFor demonstration, please consider that a developer manages the following\ncode as part of `main.go`:\n\n```golang\npackage main\n\nimport (\n        \"flag\"\n        \"fmt\"\n        \"github.com/greenpau/versioned\"\n        \"os\"\n)\n\nvar (\n        app        *versioned.PackageManager\n        appVersion string\n        gitBranch  string\n        gitCommit  string\n        buildUser  string\n        buildDate  string\n)\n\nfunc init() {\n    app = versioned.NewPackageManager(\"myapp\")\n    app.Description = \"MyApp\"\n    app.Documentation = \"https://github.com/me/myapp\"\n    app.SetVersion(appVersion, \"1.0.0\")\n    app.SetGitBranch(gitBranch, \"master\")\n    app.SetGitCommit(gitCommit, \"v1.0.0-dirty\")\n    app.SetBuildUser(buildUser, \"\")\n    app.SetBuildDate(buildDate, \"\")\n}\n```\n\nIn the `init()` function, the developer initializer `versioned` package\nmanager and sets default application name, description, and documentation.\nThese do not change at runtime.\n\nNext, notice the `var` section, where there are a number of `string`\nvariable. At runtime, the values of the variables are not initialized.\nThe values are empty strings.\n\nOne way to initialize them is using `ldflags` at build time.\nHere, the `APP_VERSION` variable is set to the value from\n`VERSION` file.\n\nThen, the variable is being user to set `main.appVersion`.\nThe `main` is the package in the code above and `appVersion`\nis the variable that are being set at build time.\n\n```bash\nAPP_VERSION:=$(shell cat VERSION | head -1)\nGIT_COMMIT:=$(shell git describe --dirty --always)\nGIT_BRANCH:=$(shell git rev-parse --abbrev-ref HEAD -- | head -1)\nBUILD_USER:=$(shell whoami)\nBUILD_DATE:=$(shell date +\"%Y-%m-%d\")\n\n        @CGO_ENABLED=0 go build -o bin/myapp -v \\\n                -ldflags=\"-w -s \\\n                -X main.appVersion=$(APP_VERSION) \\\n                -X main.gitBranch=$(GIT_BRANCH) \\\n                -X main.gitCommit=$(GIT_COMMIT) \\\n                -X main.buildUser=$(BUILD_USER) \\\n                -X main.buildDate=$(BUILD_DATE)\" \\\n                -gcflags=\"all=-trimpath=$(GOPATH)/src\" \\\n                -asmflags=\"all=-trimpath $(GOPATH)/src\" cmd/mypapp/*.go\n```\n\nThe end result os that the following variables are being set with values.\n\n```golang\n        appVersion string\n        gitBranch  string\n        gitCommit  string\n        buildUser  string\n        buildDate  string\n```\n\nHowever, what happen when a user does not use `-ldflags`.\n\nIn that case, `versioned` sets a number of defaults. For example,\nif `appVersion` is not being wtih `-ldflags`, then the default\n`1.0.0` will be set.\n\n```golang\n    app.SetVersion(appVersion, \"1.0.0\")\n    app.SetGitBranch(gitBranch, \"master\")\n    app.SetGitCommit(gitCommit, \"v1.0.0-dirty\")\n    app.SetBuildUser(buildUser, \"\")\n    app.SetBuildDate(buildDate, \"\")\n```\n\nA developer, prior to releasing code, would put proper defaults.\nThis way when someone build the code, it would inherit a set of\ndefault values for version, git, and build metadata.\n\nFurther, the `versioned` can be used to update the default values.\n\n```bash\nversioned -sync cmd/myapp/main.go\n```\n\n### Python\n\nThe `versioned` inspects Python file for the presense of `__version__` module\nlevel dunder (see PEP 8) and, if necessary, updates the version to match the\none found in `VERSION` file.\n\nThe following command detects the code uses Python based on the `.py`\nextension and synchronizes the version.\n\n```bash\nversioned -sync requests.py\n```\n\nAlternatively, when a Python file does not have an extension, use `--format`\nto explicitly state the way the file should be handled.\n\n```bash\nversioned -sync app-client --format python\n```\n\nAdditionally, if a file is a part of a Python package, then there is no need\nfor `VERSION` file. Rather, use `--source` to indicate the source of truth\nfor version information.\n\n```bash\nversioned --source setup.py -sync requests.py\n```\n\n### Node.js, Javascript, Typescript\n\nThe `versioned` inspects `npm` package file for version information.\nThe following command displays the current version of a package.\n\n```bash\n$ versioned --source package.json\n1.0.1\n```\n\nThe following command patches the version to `1.0.2`:\n\n```bash\n$ versioned --source package.json --patch\nincreased patch version by 1, current version: 1.0.2\nupdated version: 1.0.2, previous version: 1.0.1\n```\n\nAs for the synchronization of the version in `package.json` and other\nfiles in the package, the following rules apply.\n\nConsider creating `src/Config.ts` Typescript file.\n\n```ts\nexport const Config = {\n  Version: \"1.0.0\",\n};\n```\n\nThe `versioned` finds a reference to `Version` and syncronizes the value:\n\n```bash\nversioned --source package.json --sync src/Config.ts\n```\n\nAfter running the above command, the version in `package.json` and `src/Config.ts`\nwill be identical.\n\n```ts\nexport const Config = {\n  Version: \"1.0.2\",\n};\n```\n\nThe `versioned` reads `VERSION` file and updates `package.json` accordingly:\n\n```bash\nversioned --sync package.json\n```\n\n### Blender Files\n\nYou can automatically sync the version inside a Blender add-on's `bl_info` dictionary with your project's `VERSION` file.\n\nUse the following command:\n\n```bash\nversioned -release -sync blender_addon/__init__.py -format blender\n```\n\n* Locates the `version` field inside the `bl_info` dictionary\n* Compares it to the version defined in your `VERSION` file\n* Updates the tuple (e.g. `(1, 2, 3)`) if it does not match\n* Leaves the file unchanged if the versions are already in sync\n\nThis ensures your Blender add-on metadata always matches your project release version.\n\n## Markdown Table of Contents\n\nThe `versioned` is capable of generating and updating of a Table of Contents\n(TOC) in Markdown `README.md` file.\n\nThe following command either generates or updates the Table of Contents in\n`README.md` file:\n\n```bash\nversioned --toc\n```\n\nAlternatively, specify Markdown file path:\n\n```bash\nversioned -toc -filepath ./another_doc.md\n```\n\n## License Header\n\nThe `versioned` is capable of update license header. The default license type\nis Apache License 2.0:\n\n```bash\nversioned -addlicense -copyright=\"Paul Greenberg (greenpau@outlook.com)\" -year=2020 -filepath ./main.go\n```\n\nThe following command finds all `.swift` files and adds GPLv3 license header.\n\n```bash\nfor src_file in `find ./ -type f -name '*.swift'`; do\n  versioned -addlicense -copyright=\"Paul Greenberg (greenpau@outlook.com)\" -year=2023 -license gpl3 -filepath=$src_file;\ndone\n```\n\nThe available license headers are:\n* `mit`\n* `asl`\n* `apache`\n* `gpl3`\n\nThe following command removes license header from a file:\n\n```bash\nversioned -striplicense -filepath=toc_test.go\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenpau%2Fversioned","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgreenpau%2Fversioned","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgreenpau%2Fversioned/lists"}