{"id":29626088,"url":"https://github.com/xom9ikk/version-by-tag","last_synced_at":"2025-07-21T07:01:44.999Z","repository":{"id":65162380,"uuid":"319043644","full_name":"xom9ikk/version-by-tag","owner":"xom9ikk","description":"Github Action to generate version and unique version code based on the last tag","archived":false,"fork":false,"pushed_at":"2020-12-06T13:49:15.000Z","size":82,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-07T09:17:40.226Z","etag":null,"topics":["actions","android","code","github","node","semver","tag","version","version-code"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/simple-version","language":"TypeScript","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/xom9ikk.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}},"created_at":"2020-12-06T13:47:07.000Z","updated_at":"2023-03-09T02:22:18.000Z","dependencies_parsed_at":"2023-01-04T12:39:07.572Z","dependency_job_id":null,"html_url":"https://github.com/xom9ikk/version-by-tag","commit_stats":{"total_commits":1,"total_committers":1,"mean_commits":1.0,"dds":0.0,"last_synced_commit":"51cd8322dc728ecbe50f6281e0dcbe626089562f"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/xom9ikk/version-by-tag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xom9ikk%2Fversion-by-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xom9ikk%2Fversion-by-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xom9ikk%2Fversion-by-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xom9ikk%2Fversion-by-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xom9ikk","download_url":"https://codeload.github.com/xom9ikk/version-by-tag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xom9ikk%2Fversion-by-tag/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266204790,"owners_count":23892381,"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":["actions","android","code","github","node","semver","tag","version","version-code"],"created_at":"2025-07-21T07:01:17.540Z","updated_at":"2025-07-21T07:01:44.992Z","avatar_url":"https://github.com/xom9ikk.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# version-by-tag@v1\n\u003e Github Action to generate version and unique version code based on the last tag\n\n## 🔥 Usage\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-16.04\n\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v2\n        with:\n          path: custom_path_to_repo\n\n      - name: Get version and version code\n        uses: xom9ikk/version-by-tag@v1\n        id: version_by_tag\n        with:\n          path: custom_path_to_repo\n          isUseGithubRunNumber: false\n          offset: 77\n\n      - name: Some other action\n        run: |\n          echo \"Tag: ${{ steps.version_by_tag.outputs.tag }}\"\n          echo \"Semver: ${{ steps.version_by_tag.outputs.semver }}\"\n          echo \"Version code: ${{ steps.version_by_tag.outputs.versionCode }}\"\n```\n\n## ⭐ Quick results table\n\nInstead of 1000 words of description, it is better to see how it works and what results are obtained:\n\n| in:tag           | in:isUseGithubRunNumber | in:github.runNumber | in:offset     | out:versionCode |\n|------------------|-------------------------|---------------------|---------------|-----------------|\n| v1               | false                   | 0                   | 0             | 10000000        |\n| v2.7             | false                   | 0                   | 0             | 20070000        |\n| v3.9.2           | false                   | 0                   | 0             | 30090002        |\n| 8.3.7            | false                   | 0                   | 0             | 80030007        |\n| 4.2.6-alpha      | false                   | 0                   | 0             | 40020006        |\n| v99.999.9999     | false                   | 0                   | 0             | 999999999       |\n| v98.765.4321     | false                   | 0                   | 0             | 987654321       |\n| v27.74.95        | false                   | 33                  | 0             | 270740095       |\n| v27.74.95        | true                    | 33                  | 0             | 270740128       |\n| v27.74.95        | true                    | 33 (ignore)         | 77            | 270740172       |\n\n## ✨ Features\n* ♻️ getting a tag from a repository;\n* 🦄 creating a unique versionCode using the Github Action counter;\n* 🎸 ability to set a custom offset for versionCode;\n* 💎 simple API;\n\n## 💡 Input\n\n| property               | isRequired | default | comment                                                                                                      | example\n|------------------------|:----------:|:-------:|--------------------------------------------------------------------------------------------------------------|:--------:\n| `path`                 |      x     | ./      | the path to the git repository in which the last tag will be searched.                                       | ./custom/path/to/repo\n| `isUseGithubRunNumber` |      x     | true    | indicates whether to use a variable ${{ github.run_number }} from Github Actions to generate a version code. | true\n| `offset`               |      x     | 0       | value to be added to the version code. If not 0, then the isUseGithubRunNumber parameter will be ignored | 13\n\n## 📦 Output\n\n| property      | comment                                                  | example\n|---------------|----------------------------------------------------------|---------\n| `tag`         | the tag that was retrieved from the github repository.   | v2.3.26.3-alpha\n| `semver`      | valid semver that was retrieved from the tag.            | 2.3.26\n| `versionCode` | number that can be used as a build number (Android etc). | 2003026\n\n\n## 🧩 Notes\nThis action gets the latest tag from the cloned repository using git. Any method can be used for cloning. Prefer [actions/checkout@v2](https://github.com/marketplace/actions/checkout).\n\nRunning this action sets the working directory from `path`. \n\nBy default, during normal cloning, git does not load tags, so the command is executed: `git fetch --prune --unshallow`.\nAfter that, we take the last tag for the current branch with the command: `git describe --tags --abbrev = 0`\n\nOnce we get a valid semver, we calculate the versionCode. To do this, use the formula `major * 1000000 + minor * 1000 + patch + [github.runNumber | offset]`. `major` /` minor` / `patch` are taken from the semver obtained earlier.\n\nAs an example, versionCode is later useful for changing the version of the gradle file for building an Android application. By default, `versionCode` will be unique, since the `${{ github.run_number }}` variable will be added to it. This behavior can be changed using the `isUseGithubRunNumber` flag.\n\nOffset is also available. If it is other than 0, the `isUseGithubRunNumber` flag will be played. This is convenient in cases where, before using this GitHub Action, a version has already been compiled and published, which was calculated using the `versionCode` formula above.\nExample of how to use and \"unique\" build number and small offset (123)\n\n```yaml\n# 1st step\n# ...some instructions\n- name: Calculate offset and set env\n  run: echo OFFSET=`echo $((123 + ${{ github.run_number }}))` \u003e\u003e $GITHUB_ENV\n```\n\n```yaml\n# 2nd step\n# ...some instructions\n- name: Get version and version code\n  uses: xom9ikk/version-by-tag@v1\n  id: version_by_tag\n  with:\n    path: custom_path_to_repo\n    isUseGithubRunNumber: false\n    offset: ${{ env.OFFSET }}\n```\n\nOr any similar cases you might come across...\n\n# ✋ Warning\nGoogle Play has limitations on the maximum value of versionCode.\n\u003e Warning: The greatest value Google Play allows for versionCode is 2100000000.\n\nBecause of this, there are some restrictions when using the library.\n\n# 🙈 Restrictions\n\n| property    | max value               |\n|-------------|-------------------------|\n| versionCode | 2100000000              |\n| major       | 99                      | \n| minor       | 999                     |\n| patch       | 9999                    |\n| offset      | patch+offset \u003c 9999     |\n| run_number  | patch+run_number \u003c 9999 |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxom9ikk%2Fversion-by-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxom9ikk%2Fversion-by-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxom9ikk%2Fversion-by-tag/lists"}