Skip to content

Commit

Permalink
update create-release to use gsed when available
Browse files Browse the repository at this point in the history
  • Loading branch information
juruen authored and ddvk committed Sep 23, 2024
1 parent e7b8155 commit 2a7afab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/create-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ where `0.0.3` is an example of a new release version that needs to be replaced w
This script changes a few files to update the new version. It also creates the corresponding tag and outputs
the two `git` commands that need to be executed.

This scripts needs `gnu-sed` if you are running it from OSX.

Once those two commands are run, you should see a new workflow triggered in the `Actions` tab, and eventually,
the new release should show up in the `releases` sections with its corresponding assests.
15 changes: 12 additions & 3 deletions script/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ set -e

# Script to prepare a new rmapi release

SED="sed"

set_sed(){
if $(which gsed 2>&1 >/dev/null); then
SED="gsed"
fi
}

update_app_version(){
local version=$1
sed -i "s/const Version = \".*\"/const Version = \"$version\"/" version/version.go
$SED -i "s/var Version = \".*\"/var Version = \"$version\"/" version/version.go
}

update_changelog(){
local version=$1
sed -i "1c## rmapi $version ($(date "+%B %d, %Y"))" CHANGELOG.md
$SED -i "1c## rmapi $version ($(date "+%B %d, %Y"))" CHANGELOG.md
}

update_macosx_tutorial(){
local version=$1
sed -i "s/v.*\/rmapi-macosx.zip/v${version}\/rmapi-macosx.zip -o rmapi.zip/" docs/tutorial-print-macosx.md
$SED -i "s/v.*\/rmapi-macosx.zip/v${version}\/rmapi-macosx.zip -o rmapi.zip/" docs/tutorial-print-macosx.md
}

create_tag(){
Expand All @@ -42,6 +50,7 @@ if [ -z "$1" ]; then
fi

version=$1
set_sed
update_app_version $version
update_changelog $version
update_macosx_tutorial $version
Expand Down

0 comments on commit 2a7afab

Please sign in to comment.