Skip to content

Commit

Permalink
Modify the Appveyor version if present
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas committed Feb 1, 2023
1 parent b973b5b commit 7378d0a
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ You can turn off the Dockerfile feature with:
git config --bool gitflow.branch.bump-dockerfile false
```

The scripts will also bump the [Appveyor](https://www.appveyor.com) version if it is present.

You can turn off the Appveyor feature with:
```bash
git config --bool gitflow.branch.bump-appveyor false
```


## Usage

Expand Down
7 changes: 7 additions & 0 deletions hooks/common/filter-flow-hotfix-start-version
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ if [[ ! $BUMP =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
VERSION=$(bump_version $VERSION $BUMP) ; die_on_error
fi

if get_config_bool gitflow.branch.bump-appveyor true; then
if [[ -f appveyor.yml ]]; then
update_appveyor_version appveyor.yml $VERSION
git stash push --message "appveyor" --quiet appveyor.yml
fi
fi

if get_config_bool gitflow.branch.bump-chart true; then
CHART_DIR=$(get_config gitflow.path.chart "$ROOT_DIR/chart")
if [[ -f $CHART_DIR/Chart.yaml ]]; then
Expand Down
7 changes: 7 additions & 0 deletions hooks/common/filter-flow-release-start-version
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ if [[ ! $BUMP =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
VERSION=$(bump_version $VERSION $BUMP) ; die_on_error
fi

if get_config_bool gitflow.branch.bump-appveyor true; then
if [[ -f appveyor.yml ]]; then
update_appveyor_version appveyor.yml $VERSION
git stash push --message "appveyor" --quiet appveyor.yml
fi
fi

if get_config_bool gitflow.branch.bump-chart true; then
CHART_DIR=$(get_config gitflow.path.chart "$ROOT_DIR/chart")
if [[ -f $CHART_DIR/Chart.yaml ]]; then
Expand Down
12 changes: 12 additions & 0 deletions hooks/common/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,15 @@ function update_dockerfile_version() { # {{{2
status=$? ; (( status )) && error "Failed to update ${file##*/}, exit code: $status" || success "Updated ${file##*/}"
} # 2}}}

function update_appveyor_version() { # {{{2
local file=$1
local version=$2
local status

verbose "Updating: ${file##*/}"
sed -Ei \
-e "/^version:/s/.*/version: ${version}+{build}/" \
"$file"
status=$? ; (( status )) && error "Failed to update ${file##*/}, exit code: $status" || success "Updated ${file##*/}"
} # 2}}}

13 changes: 13 additions & 0 deletions hooks/common/post-flow-hotfix-start
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ if get_config_bool gitflow.branch.bump-chart true; then
fi
fi

if get_config_bool gitflow.branch.bump-appveyor true; then
if [[ -f appveyor.yml ]]; then
stash=$(git stash list | awk '/appveyor/{gsub(":","",$1); print $1}')
if [[ -n $stash ]]; then
git stash pop --quiet $stash
git add appveyor.yml
die_on_error "Failed to stage appveyor.yml"
git commit -m "Updated Appveyor version" appveyor.yml
die_on_error "Failed to commit new Appveyor version $VERSION"
fi
fi
fi

VERSION_FILE=$(find_version_file)
die_on_error

Expand Down
13 changes: 13 additions & 0 deletions hooks/common/post-flow-release-start
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ if get_config_bool gitflow.branch.bump-chart true; then
fi
fi

if get_config_bool gitflow.branch.bump-appveyor true; then
if [[ -f appveyor.yml ]]; then
stash=$(git stash list | awk '/appveyor/{gsub(":","",$1); print $1}')
if [[ -n $stash ]]; then
git stash pop --quiet $stash
git add appveyor.yml
die_on_error "Failed to stage appveyor.yml"
git commit -m "Updated Appveyor version" appveyor.yml
die_on_error "Failed to commit new Appveyor version $VERSION"
fi
fi
fi

VERSION_FILE=$(find_version_file)
die_on_error "$VERSION_FILE"

Expand Down

0 comments on commit 7378d0a

Please sign in to comment.