- Shell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github | ||
| test | ||
| .all-contributorsrc | ||
| .gitignore | ||
| .whitesource | ||
| action.yml | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| entrypoint.sh | ||
| HISTORY.md | ||
| LICENSE | ||
| README.md | ||
sync-release-version
Problem
With multiple files that need to be updated each time a new released is created.
sync-release-version makes this process less complex by using a regex pattern to match the lines in the specified files that needs to be updated.
Helpful Resources
Usage
Sync a project release version number.
Update files that reference a project version with a new release number.
[!NOTE]
- This example assumes a post release operation i.e changes are made to a README after a new version is releaased.
...
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- name: Sync release version.
uses: tj-actions/sync-release-version@2a7ef0deb39b3ecce887ee99d2261c6cef989d84 # v13
id: sync-release-version
with:
pattern: 'version='
current_version: '1.0.1' # Omit this to use git tag.
new_version: '1.0.2' # Omit this to use git tag.
paths: |
README.md
test/subdir/README.md
- run: |
echo "Upgraded from ${{ steps.sync-release-version.outputs.old_version }} -> ${{ steps.sync-release-version.outputs.new_version }}"
Recomended usage with peter-evans/create-pull-request@v3
name: Update release version.
on:
release:
types: [published]
jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sync release version.
uses: tj-actions/sync-release-version@2a7ef0deb39b3ecce887ee99d2261c6cef989d84 # v13
id: sync-release-version
with:
pattern: 'tj-actions/sync-release-version@'
paths: |
README.md
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
base: "main"
title: "Upgraded to ${{ steps.sync-release-version.outputs.new_version }}"
branch: "upgrade-to-${{ steps.sync-release-version.outputs.new_version }}"
commit-message: "Upgraded from ${{ steps.sync-release-version.outputs.old_version }} -> ${{ steps.sync-release-version.outputs.new_version }}"
body: "View [CHANGES](https://github.com/${{ github.repository }}/compare/${{ steps.sync-release-version.outputs.old_version }}...${{ steps.sync-release-version.outputs.new_version }})"
reviewers: "jackton1"
Example
Creating a new release v6.8 -> v7 using the recommended configuration above.
BEFORE
README.md
...
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sync release version.
uses: tj-actions/sync-release-version@v6.8
AFTER
README.md
...
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sync release version.
uses: tj-actions/sync-release-version@v7
Inputs
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|---|---|---|---|---|
| current_version | string | false | The current project version (Default: The last git tag). | |
| new_version | string | false | The next project version (Default: The new git tag). | |
| only_major | string | false | "false" |
Only update the major version number. |
| paths | string | true | A list of file names to search and replace versions. |
|
| pattern | string | false | The pattern to match the location that needs to be updated. |
|
| strip_prefix | string | false | Prefix to strip from the tag. For example if strip_prefix is set to v and the tag is v1.0.0 the output becomes 1.0.0. |
|
| use_tag_commit_hash | string | false | "false" |
When true, uses commit hash in the replacement pattern. For example, replaces hash # v1 with hash # v2. |
Outputs
| OUTPUT | TYPE | DESCRIPTION |
|---|---|---|
| is_initial_release | string | Boolean indicating an initial release. |
| major_update | string | Boolean indicating a major version bump |
| new_version | string | The current project version |
| old_version | string | The previous project version |
- Free software: MIT license
If you feel generous and want to show some extra appreciation:
Features
- Modifies files with an up to date version of your project based on each release tag.
Known Limitation
[!IMPORTANT]
- To ignore certain lines from getting updated ensure the version used doesn't match either the current or previous version.
Credits
This package was created with Cookiecutter.
Report Bugs
Report bugs at https://github.com/tj-actions/sync-release-version/issues.
If you are reporting a bug, please include:
- Your operating system name and version.
- Any details about your workflow that might be helpful in troubleshooting.
- Detailed steps to reproduce the bug.
Contributors ✨
Thanks goes to these wonderful people (emoji key):
Raphael Boidol 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!

