Skip to content

Commit eb4cb8d

Browse files
authored
Merge pull request #2 from h-haider1013/add-new-version-option
Add NEW_VERSION option
2 parents 5fc0102 + 21f32ae commit eb4cb8d

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

.bumpversion.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ search = version="{current_version}"
88
replace = version="{new_version}"
99

1010
[bumpversion:file:README.md]
11-
search = jaumann/github-tag-action@{current_version}
12-
replace = jaumann/github-tag-action@{new_version}
11+
search = jaumann/github-bumpversion-action@v{current_version}
12+
replace = jaumann/github-bumpversion-action@v{new_version}

.hadolint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ignored:
2+
- DL3018 # pin apk packages version
3+
- DL3013 # pin pip packages version

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v2
2323
- name: Bump version and push tag
24-
uses: jaumann/github-tag-action@0.0.6
24+
uses: jaumann/github-bumpversion-action@v0.0.6
2525
env:
2626
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2727
- name: Push changes
@@ -39,6 +39,7 @@ jobs:
3939
* **DEFAULT_BUMP** *(optional)* - Which type of bump to use when none explicitly provided (default: `minor`).
4040
* **SOURCE** *(optional)* - Operate on a relative path under $GITHUB_WORKSPACE.
4141
* **DRY_RUN** *(optional)* - Determine the next version without tagging the branch. The workflow can use the outputs `new_tag` and `tag` in subsequent steps. Possible values are ```true``` and ```false``` (default).
42+
* **NEW_VERSION** *(optional)* - New version that should be in the files.
4243

4344

4445
### Outputs

entrypoint.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
default_semvar_bump=${DEFAULT_BUMP:-patch}
55
source=${SOURCE:-.}
66
dryrun=${DRY_RUN:-false}
7+
new_version=${NEW_VERSION:-""}
78

89
cd "${GITHUB_WORKSPACE}/${source}" || return
910

@@ -39,7 +40,13 @@ case "$log" in
3940
* ) part="$default_semvar_bump";;
4041
esac
4142

42-
raw_output=$(bumpversion --list "$part" --dry-run)
43+
# check if new version is already specified
44+
if [ -z "$new_version" ]; then
45+
raw_output=$(bumpversion --list "$part" --dry-run)
46+
else
47+
raw_output=$(bumpversion --list "$part" --dry-run --new-version="$new_version")
48+
fi
49+
4350
old_version=$(echo "$raw_output" | grep -o 'current_version=\S*' | cut -d= -f2)
4451
new_version=$(echo "$raw_output" | grep -o 'new_version=\S*' | cut -d= -f2)
4552

@@ -60,5 +67,5 @@ if [ "$dryrun" = true ]; then
6067
else
6168
git config --global user.email "bumpversion@github-actions"
6269
git config --global user.name "BumpVersion Action"
63-
bumpversion "$part" --verbose
70+
bumpversion "$part" --new-version="$new_version" --verbose
6471
fi

0 commit comments

Comments
 (0)