From 85d68cbbf11cf8173e860e2609eaeb52f5bcf0ce Mon Sep 17 00:00:00 2001 From: Stefan Feilmeier Date: Fri, 1 Sep 2023 16:30:18 +0200 Subject: [PATCH] Push version to 2023.9.0 --- .../io/openems/common/OpenemsConstants.java | 2 +- tools/prepare-release.sh | 60 ++++++++----------- ui/package-lock.json | 4 +- ui/package.json | 2 +- .../view/component/changelog.constants.ts | 2 +- 5 files changed, 31 insertions(+), 39 deletions(-) diff --git a/io.openems.common/src/io/openems/common/OpenemsConstants.java b/io.openems.common/src/io/openems/common/OpenemsConstants.java index 5bd87b2c4ec..34ffb7c0b31 100644 --- a/io.openems.common/src/io/openems/common/OpenemsConstants.java +++ b/io.openems.common/src/io/openems/common/OpenemsConstants.java @@ -43,7 +43,7 @@ public class OpenemsConstants { /** * The additional version string. */ - public static final String VERSION_STRING = "SNAPSHOT"; + public static final String VERSION_STRING = ""; /** * The complete version as a SemanticVersion. diff --git a/tools/prepare-release.sh b/tools/prepare-release.sh index d3c9502a8ff..a32d2babbf3 100644 --- a/tools/prepare-release.sh +++ b/tools/prepare-release.sh @@ -1,43 +1,35 @@ -# Prepares a Release +#!/bin/bash # -# - Removes the SNAPSHOT tag from version +# Prepares a Release by removing the SNAPSHOT tag from version # -# E.g. increases 2020.1.0-SNAPSHOT to 2020.1.0 +# i.e. changes 2023.9.0-SNAPSHOT to 2023.9.0 -# Basic definitions -release_date=$(date --iso-8601) -openems_constants="io.openems.common/src/io/openems/common/OpenemsConstants.java" -package_json="ui/package.json" -package_lock="ui/package-lock.json" -changelog_constants="ui/src/app/changelog/view/component/changelog.constants.ts" +set -e -# Reset files -git checkout $openems_constants -git checkout $package_json -git checkout $package_lock -git checkout $changelog_constants +main() { + initialize_environment + common_update_version_in_code + common_build_ui + echo "# Ready for commit: "Push version to $VERSION"" +} -# Find new Version" -major=$(grep 'VERSION_MAJOR =' $openems_constants | sed 's/^.*= \([0-9]\+\);/\1/') -minor=$(grep 'VERSION_MINOR =' $openems_constants | sed 's/^.*= \([0-9]\+\);/\1/') -patch=$(grep 'VERSION_PATCH =' $openems_constants | sed 's/^.*= \([0-9]\+\);/\1/') -new_version="${major}.${minor}.${patch}" -echo "# Release version: $new_version" -echo "# date: $release_date" +initialize_environment() { + # Set working directory + SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) + cd ${SCRIPT_DIR}/.. -echo "# Update $openems_constants" -sed --in-place 's/\(public .* VERSION_STRING = "\)SNAPSHOT\(".*$\)/\1\2/' $openems_constants + # Include commons + source $SCRIPT_DIR/common.sh + common_initialize_environment -echo "# Update $package_json" -sed --in-place "s/\(\"version\": \"\).*\(\".*$\)/\1$new_version\2/" $package_json + # Target version + VERSION_STRING="" + VERSION="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH" -echo "# Update $package_lock" -sed --in-place "s/\(^ \"version\": \"\).*\(\".*$\)/\1$new_version\2/" $package_lock + # Reset files + git checkout $SRC_OPENEMS_CONSTANTS 2>/dev/null + git checkout $SRC_PACKAGE_JSON 2>/dev/null + git checkout $SRC_CHANGELOG_CONSTANTS 2>/dev/null +} -echo "# Update $changelog_constants" -sed --in-place "s/\(UI_VERSION = \).*$/\1\"$version_string\";/" $changelog_constants - -echo "# Finished" - -echo "" -echo "# Ready for commit: \"Push version to $new_version\"" +main; exit \ No newline at end of file diff --git a/ui/package-lock.json b/ui/package-lock.json index 9e65b4e8965..819b6fb33a1 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -1,12 +1,12 @@ { "name": "openems-ui", - "version": "2023.9.0-SNAPSHOT", + "version": "2023.9.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "openems-ui", - "version": "2023.9.0-SNAPSHOT", + "version": "2023.9.0", "license": "AGPL-3.0", "dependencies": { "@angular/animations": "~15.2.9", diff --git a/ui/package.json b/ui/package.json index 9215d8fa925..1ac6823ae30 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,6 +1,6 @@ { "name": "openems-ui", - "version": "2023.9.0-SNAPSHOT", + "version": "2023.9.0", "license": "AGPL-3.0", "private": true, "dependencies": { diff --git a/ui/src/app/changelog/view/component/changelog.constants.ts b/ui/src/app/changelog/view/component/changelog.constants.ts index ca09d4762e4..630515a3daf 100644 --- a/ui/src/app/changelog/view/component/changelog.constants.ts +++ b/ui/src/app/changelog/view/component/changelog.constants.ts @@ -2,7 +2,7 @@ import { Role } from "src/app/shared/type/role"; export class Changelog { - public static readonly UI_VERSION = "2023.9.0-SNAPSHOT"; + public static readonly UI_VERSION = "2023.9.0"; public static product(...products: Product[]) { return products.map(product => Changelog.link(product.name, product.url)).join(", ") + '. ';