Skip to content

Commit c882439

Browse files
committed
docs: improve README with enhanced structure and details
- Added section explaining platform targeting. - Improved usage examples with YAML snippets. - Added input descriptions table. - Clarified how to specify target paths. - Included new Code of Conduct section.
1 parent 8e2c516 commit c882439

1 file changed

Lines changed: 81 additions & 36 deletions

File tree

README.md

Lines changed: 81 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,28 @@
44
[![Release](https://img.shields.io/github/v/release/taj54/universal-version-bump?label=version)](https://github.com/taj54/universal-version-bump/releases)
55
[![Test](https://github.com/taj54/universal-version-bump/actions/workflows/test.yml/badge.svg)](https://github.com/taj54/universal-version-bump/actions/workflows/test.yml)
66
[![License](https://img.shields.io/github/license/taj54/universal-version-bump)](LICENSE)
7+
[![Code of Conduct](https://img.shields.io/badge/code%20of%20conduct-enforced-blue)](CODE_OF_CONDUCT.md)
78

89
A GitHub Action to automatically bump versions for any project that has a version file.
910

10-
This action will automatically detect the version file (e.g. `package.json`, `pyproject.toml`, etc.) and bump the version according to the `release_type` input. If multiple version files are found, the action will use the one that is most commonly used for the project type.
11+
This action will automatically detect the version file and bump the version according to the `release_type` input. If multiple version files are found, the action will use the one that is most commonly used for the project type.
12+
13+
## How it works
14+
15+
The action will first try to detect the platform of the project by looking for common version files in the root directory. The following files are supported:
16+
17+
| Platform | Version File |
18+
| --- | --- |
19+
| Docker | `Dockerfile` |
20+
| Go | `go.mod` |
21+
| Node | `package.json` |
22+
| PHP | `composer.json` |
23+
| Python | `pyproject.toml`, `setup.py` |
24+
| Rust | `Cargo.toml` |
25+
26+
If a version file is found, the action will bump the version in that file. If no version file is found, the action will fail.
27+
28+
You can also explicitly specify the platform to update by using the `target_platform` input. This is useful for monorepos or projects with multiple potential manifest files.
1129

1230
## Usage
1331

@@ -20,31 +38,21 @@ To use this action in your workflow, add the following step:
2038
release_type: 'patch' # patch, minor, or major
2139
```
2240
23-
## Inputs
24-
25-
| Name | Description | Default |
26-
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------- |
27-
| `release_type` | Select the version bump type (patch, minor, major) | `patch` |
28-
| `git_tag` | Whether to create a Git tag after bump | `true` |
29-
| `target_platform` | Explicitly specify the platform to update (e.g., `node`, `python`). If not provided, the platform will be detected automatically. | `''` |
30-
| `target_path` | The target path where the version bump should be applied. If not provided, the action will run in the root directory. | `.` |
41+
### Bumping a version in a specific directory
3142
32-
### Explicit Platform Targeting (`target_platform`)
43+
To bump a version in a specific directory, use the `target_path` input:
3344

34-
By default, the action automatically detects the project's platform based on common manifest files (e.g., `package.json` for Node.js, `pyproject.toml` for Python). However, in certain scenarios, such as monorepos or projects with multiple potential manifest files, you might want to explicitly control which platform's version is bumped.
35-
36-
The `target_platform` input allows you to specify the exact platform you intend to update. When this input is provided, the action will bypass its automatic detection and directly attempt to update the version for the specified platform.
37-
38-
Supported platforms include:
45+
```yaml
46+
- name: Bump version in my-app
47+
uses: taj54/[email protected]
48+
with:
49+
release_type: 'patch'
50+
target_path: 'my-app'
51+
```
3952

40-
- `node` (for Node.js projects using `package.json`)
41-
- `python` (for Python projects using `pyproject.toml` or `setup.py`)
42-
- `docker` (for Docker projects using `Dockerfile`)
43-
- `go` (for Go projects using `go.mod`)
44-
- `php` (for PHP projects using `composer.json`)
45-
- `rust` (for Rust projects using `Cargo.toml`)
53+
### Explicitly targeting a platform
4654

47-
**Example:**
55+
To explicitly target a platform, use the `target_platform` input:
4856

4957
```yaml
5058
- name: Bump Node.js version
@@ -54,40 +62,77 @@ Supported platforms include:
5462
target_platform: 'node' # Explicitly target Node.js
5563
```
5664

65+
## Inputs
66+
67+
| Name | Description | Default |
68+
| --- | --- | --- |
69+
| `release_type` | Select the version bump type (patch, minor, major) | `patch` |
70+
| `git_tag` | Whether to create a Git tag after bump | `true` |
71+
| `target_platform` | Explicitly specify the platform to update (e.g., `node`, `python`). If not provided, the platform will be detected automatically. | `''` |
72+
| `target_path` | The target path where the version bump should be applied. If not provided, the action will run in the root directory. | `.` |
73+
5774
## Outputs
5875

59-
| Name | Description |
60-
| ------------- | -------------------------------- |
61-
| `new_version` | The new bumped version |
62-
| `tag` | The created Git tag (if enabled) |
76+
| Name | Description |
77+
| --- | --- |
78+
| `new_version` | The new bumped version |
79+
| `tag` | The created Git tag (if enabled) |
6380

6481
## Example Workflow
6582

6683
```yaml
67-
name: Bump Version
84+
name: Version Bump
85+
86+
permissions:
87+
contents: write
88+
pull-requests: write
6889
6990
on:
70-
push:
71-
branches:
72-
- main
91+
workflow_dispatch:
92+
inputs:
93+
release_type:
94+
description: 'Select version bump type'
95+
required: true
96+
default: 'patch'
97+
type: choice
98+
options:
99+
- patch
100+
- minor
101+
- major
102+
103+
73104
74105
jobs:
75106
bump:
76107
runs-on: ubuntu-latest
77108
steps:
78-
- name: Checkout code
79-
uses: actions/checkout@v2
109+
- name: Checkout
110+
uses: actions/checkout@v5
111+
with:
112+
fetch-depth: 0
80113
81-
- name: Bump version
82-
uses: taj54/universal-version-bump@v0.8.2
114+
- name: Universal Version Bump
115+
uses: taj54/universal-version-bump@v0.9.0
83116
with:
84-
release_type: 'patch'
117+
release_type: ${{ inputs.release_type }}
118+
git_tag: false
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
85122
```
86123

124+
## Development
125+
126+
For more information on how to develop this action, see the [developer guide](DEVELOPER.md).
127+
87128
## Contributing
88129

89130
Contributions are welcome! Please see the [contributing guidelines](CONTRIBUTING.md) for more information.
90131

132+
## Code of Conduct
133+
134+
This project is governed by the [Code of Conduct](CODE_OF_CONDUCT.md).
135+
91136
## License
92137

93-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
138+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)