Skip to content

Commit

Permalink
chore: Update release scripts
Browse files Browse the repository at this point in the history
- Update release version in YaksJBang.java dist files
- Update last released version in Makefile
- Properly handle version updates in docs overview.adoc
  • Loading branch information
christophd committed Mar 10, 2023
1 parent 676c9b4 commit f0f7bd2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions script/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ release() {
if [ ! $(hasflag --local-release) ] && [ ! $(hasflag --snapshot-release) ]; then
# Commit project metadata for new version
git_commit "$working_dir" project.yml "Update project metadata for $release_version"

# Commit docs overview.adoc
git_commit "$working_dir" overview.adoc "Update docs overview for $release_version"
fi

# Build and stage artifacts
Expand Down Expand Up @@ -132,6 +135,9 @@ release() {
fi

if [ ! $(hasflag --local-release) ] && [ ! $(hasflag --no-git-push) ]; then
# Update docs overview with new snapshot version
update_docs_overview "$working_dir" "$release_version" "$snapshot_version"

local remote=$(get_git_remote)

# Push changes
Expand Down Expand Up @@ -214,6 +220,26 @@ update_project_metadata() {

sed -i "s/current-version: .*/current-version: $version/" $file
sed -i "s/next-version: .*/next-version: $next_version/g" $file

file="$working_dir/Makefile"

sed -i "s/LAST_RELEASED_VERSION := .*/LAST_RELEASED_VERSION := $version/" $file

file="$working_dir/java/tools/yaks-jbang/dist/YaksJBang.java"

sed -i "s/yaks.jbang.version:.*}/yaks.jbang.version:$version}/" $file
}

update_docs_overview() {
local working_dir="$1"
local version="$2"
local snapshot_version="$3"

local file="$working_dir/java/docs/overview.adoc"

# Insert snapshot docs in line 18
local line=$(sed -n "/$version/s/$version/$snapshot_version/gp" $file)
sed -i "18 i $line" $file
}

source "$location/util/common_funcs"
Expand Down

0 comments on commit f0f7bd2

Please sign in to comment.