{"id":15612366,"url":"https://github.com/euberdeveloper/ga-project-version","last_synced_at":"2025-04-12T18:54:53.458Z","repository":{"id":59188695,"uuid":"396882943","full_name":"euberdeveloper/ga-project-version","owner":"euberdeveloper","description":"This github action gets from the package manager json file (package.json, composer.json, ...) the version of the project and exposes it","archived":false,"fork":false,"pushed_at":"2024-01-30T16:37:48.000Z","size":7218,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-26T13:11:32.703Z","etag":null,"topics":["github-actions"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/euberdeveloper.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-16T16:44:19.000Z","updated_at":"2023-10-25T16:02:46.000Z","dependencies_parsed_at":"2024-10-03T06:42:42.004Z","dependency_job_id":null,"html_url":"https://github.com/euberdeveloper/ga-project-version","commit_stats":{"total_commits":60,"total_committers":3,"mean_commits":20.0,"dds":"0.16666666666666663","last_synced_commit":"ec72a1d02e5d7fe9b4482be611121b09ff33a2fd"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euberdeveloper%2Fga-project-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euberdeveloper%2Fga-project-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euberdeveloper%2Fga-project-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/euberdeveloper%2Fga-project-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/euberdeveloper","download_url":"https://codeload.github.com/euberdeveloper/ga-project-version/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248571846,"owners_count":21126522,"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":["github-actions"],"created_at":"2024-10-03T06:42:01.166Z","updated_at":"2025-04-12T18:54:53.431Z","avatar_url":"https://github.com/euberdeveloper.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-v3-undefined.svg?logo=github\u0026logoColor=white\u0026style=flat)](https://github.com/marketplace/actions/ga-project-version)\n\n# ga-project-version\nThis github action gets from the package manager json file (package.json, composer.json, ...), or in case an xml one, the version of the project and exposes it.\n\n## Project purpose\n\nSometimes, for instance when you publish a github release or a dockerhub image through a github action, you need a properly way to choose the version. If you are using `npm` with **NodeJS** or `composer` with **PHP**, you will have a `package.json` or `composer.json` file where you can easily put the version of the project. If you are using `Maven` with `java` you will be using a `pom.xml` file. If you are using `python`, maybe you are using `poetry` or `Pipenv`. This can be extended to other languages/package managers, as long as they have a **.json**, **.xml** or a **.toml** file. This project consists in a **github action** that automatically exposes the **version** contained in those json/xml/toml files, so that they can be used by other steps of the action you are adding.\n\n## Example\n\n```yml\nname: release\n\non:\n  push:\n    branches: [ main ]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n      - uses: actions/checkout@v3\n      \n      # This is how you use the ga-project-version action\n      - name: Get version of the project\n        id: project-version\n        uses: 'euberdeveloper/ga-project-version@main'\n        with:\n          package-manager: 'composer'\n\n      # In this step the exposed version is used as tag of a github release to publish\n      - name: Add release\n        uses: \"marvinpinto/action-automatic-releases@latest\"\n        with:\n          repo_token: \"${{ secrets.GITHUB_TOKEN }}\"\n          # This is how you access the exposed version\n          automatic_release_tag: \"${{ steps.project-version.outputs.version }}\"\n          title: \"Deploy\"\n          files: |\n            backend.tar.gz\n\n```\n\n## API\n\n### Supported Parameters\n\n| Parameter         | Description                                                                                                                                        | Default     |\n| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |\n| `package-manager` | The package manager of your project (`npm`, `composer`, `maven`, `poetry` or `pipenv`).                                                                                | `npm`       |\n| `root-directory`  | The root directory (containing your `.json/.xml/.toml` file)                                                                                             | `./`        |\n| `path`            | If you have a custom json file containing the version of the project, you can specify its full path.                                               | `undefined` |\n| `version-prop`    | If in the json/xml/toml file the property containing the version is not called `version`, you can set it here. The key can be nested, like in `uno.due.tre` | `undefined` / for most cases the action behaves smartly for each package manager   |\n\n**Note:** If `path` is specified, `package-manager` and `root-directory` are ignored.\n\n### Outputs\n\nThe following output values can be accessed via `${{ steps.\u003cstep-id\u003e.outputs.\u003coutput-name\u003e }}`:\n\n| Name      | Description           | Type   |\n| --------- | --------------------- | ------ |\n| `version` | The extracted version | string |\n\n### How does it work\n\nInternally, the action is written in **Typescript**, tested with **Jest** and bundled with **EsBuild**.\n\nThe action uses directly `path` if specified, otherwise it guesses the file name by `package-manager` and the location by `root-directory`. After that, it requires the json/xml/toml file and inspects the right version property (or `version-prop` if specified) and adds it as an output.\n\n### Possible improvements\n\nSome improvements could be:\n1. Add support for gradle\n2. Add support for setup.py (tricky)\n3. Add support for yaml\n4. Refactor everything and make it more generic (path / type of file (json/xml/toml/...) / version prop) and package manager as a shortcut\n\nFeel free to make pull requests!\n\n### Development\n\nThe commits are pushed to the branch `dev`, after that an action will generate the bundle and push everything in the branch `main`. For versioning, releases are manually created.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuberdeveloper%2Fga-project-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feuberdeveloper%2Fga-project-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feuberdeveloper%2Fga-project-version/lists"}