forked from loafle/openapi-generator-original
Release versioning helper script(s) (#3110)
* Release versioning script with marker tags. Introduces bump.sh which supports moving from version to version but only within delimiting marker tags in the target file. This script currently doesn't do validations or anything fancy. * Allow bumping version according to type (major,minor,build,revision) * bump.sh will display error if file contents are unchanged
This commit is contained in:
parent
034064be4c
commit
6b428d65f6
15
README.md
15
README.md
@ -98,9 +98,9 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
OpenAPI Generator Version | Release Date | Notes
|
||||
---------------------------- | ------------ | -----
|
||||
5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/)| 13.05.2020 | Major release with breaking changes (no fallback)
|
||||
4.1.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.1.0-SNAPSHOT/)| 31.07.2019 | Minor release (breaking changes with fallbacks)
|
||||
4.1.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.1.0-SNAPSHOT/)| 15.07.2019 | Minor release (breaking changes with fallbacks)
|
||||
4.0.3 (upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.3-SNAPSHOT/)| 04.07.2019 | Patch release (minor bug fixes, etc)
|
||||
[4.0.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.0.2) (latest stable release) | 20.06.2019 | Patch release (bug fixes, minor enhancements, etc)
|
||||
<!-- RELEASE_VERSION -->[4.0.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.0.2) (latest stable release) | 20.06.2019 | Patch release (bug fixes, minor enhancements, etc)<!-- /RELEASE_VERSION -->
|
||||
|
||||
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
|
||||
|
||||
@ -153,7 +153,7 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository.
|
||||
* [Readme](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-gradle-plugin/README.adoc)
|
||||
|
||||
### [1.3 - Download JAR](#table-of-contents)
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
|
||||
|
||||
JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar`
|
||||
@ -175,7 +175,7 @@ For Mac users, please make sure Java 8 is installed (Tips: run `java -version` t
|
||||
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
|
||||
export PATH=${JAVA_HOME}/bin:$PATH
|
||||
```
|
||||
|
||||
<!-- /RELEASE_VERSION -->
|
||||
### Launcher Script
|
||||
|
||||
One downside to manual jar downloads is that you don't keep up-to-date with the latest released version. We have a Bash launcher script at [bin/utils/openapi-generator.cli.sh](./bin/utils/openapi-generator-cli.sh) which resolves this issue.
|
||||
@ -368,7 +368,8 @@ npm install @openapitools/openapi-generator-cli -g
|
||||
openapi-generator version
|
||||
```
|
||||
|
||||
Or install a particualar OpenAPI Generator version (e.g. v4.0.2):
|
||||
<!-- RELEASE_VERSION -->
|
||||
Or install a particular OpenAPI Generator version (e.g. v4.0.2):
|
||||
|
||||
```sh
|
||||
npm install @openapitools/openapi-generator-cli@cli-4.0.2 -g
|
||||
@ -379,7 +380,7 @@ Or install it as dev-dependency:
|
||||
```sh
|
||||
npm install @openapitools/openapi-generator-cli -D
|
||||
```
|
||||
|
||||
<!-- /RELEASE_VERSION -->
|
||||
## [2 - Getting Started](#table-of-contents)
|
||||
|
||||
To generate a PHP client for [petstore.yaml](https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml), please run the following
|
||||
@ -394,7 +395,9 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
|
||||
```
|
||||
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g php -o c:\temp\php_api_client`)
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
You can also download the JAR (latest release) directly from [maven.org](http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.2/openapi-generator-cli-4.0.2.jar)
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
|
||||
|
||||
|
221
bin/utils/release/bump.sh
Executable file
221
bin/utils/release/bump.sh
Executable file
@ -0,0 +1,221 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# This script bumps from one version to another
|
||||
#
|
||||
# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
declare -r version_regex="([0-9]+).([0-9]+).([0-9]+)-?(SNAPSHOT){0,1}"
|
||||
declare start="<!-- RELEASE_VERSION -->"
|
||||
declare end="<!-- \/RELEASE_VERSION -->"
|
||||
declare from="${version_regex}"
|
||||
declare to=""
|
||||
declare debug=${debug:-false}
|
||||
declare -a from_parts=()
|
||||
declare -a to_parts=()
|
||||
declare -ar inc=(major minor build snapshot)
|
||||
|
||||
USAGE="
|
||||
USAGE: $0 OPTIONS input_file
|
||||
|
||||
This script will bump a version number (or other value) between marker tags.
|
||||
|
||||
OPTIONS:
|
||||
-f The 'from' version
|
||||
-t The 'to' version
|
||||
-s The start tag regex
|
||||
default: $start
|
||||
-e The end tag regex
|
||||
default: $end
|
||||
-i Increase by one of: ${inc[@]}
|
||||
-h Print this message
|
||||
|
||||
EXAMPLES:
|
||||
|
||||
Update to next snapshot version:
|
||||
$0 -f 3.0.0 -t 3.0.1-SNAPSHOT pom.xml
|
||||
Update build version only (useful for docs)
|
||||
$0 -f 3.0.0 -t 3.0.1 pom.xml
|
||||
Update from any version to any other version
|
||||
$0 -f 1.2.3 -t 9.9.9-SNAPSHOT pom.xml
|
||||
Customize the start/end tags
|
||||
$0 -f 1.0.0 1.0.1-SNAPSHOT -s \"<!-- START -->\" -e \"<!-- END -->\" pom.xml
|
||||
"
|
||||
|
||||
|
||||
## print an error message and exit
|
||||
err() {
|
||||
>&2 echo -e "$1"
|
||||
exit 1
|
||||
}
|
||||
|
||||
## debug log messages. Run with debug=true ./bump.sh
|
||||
d() {
|
||||
if [[ true = "${debug}" ]]; then
|
||||
echo "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
## outputs usage and exits
|
||||
usage()
|
||||
{
|
||||
err "${USAGE}"
|
||||
exit 1
|
||||
}
|
||||
|
||||
## usage: version input extracted_array
|
||||
## - Checks that 'input' is a valid version
|
||||
## - Extracts the version parts into 'extracted_array'
|
||||
version()
|
||||
{
|
||||
if [[ "$#" -ne 2 ]]; then
|
||||
err "Call function version with two parameters: version string arr"
|
||||
fi
|
||||
local v=$1
|
||||
if [[ "${v}" =~ $version_regex ]]; then
|
||||
local major=${BASH_REMATCH[1]}
|
||||
local minor=${BASH_REMATCH[2]}
|
||||
local build=${BASH_REMATCH[3]}
|
||||
local snapshot=false
|
||||
if [[ "SNAPSHOT" = "${BASH_REMATCH[4]}" ]]; then
|
||||
snapshot=true
|
||||
fi
|
||||
|
||||
d "major=$major minor=$minor build=$build snapshot=$snapshot"
|
||||
|
||||
eval "$2=(${major} ${minor} ${build} ${snapshot})"
|
||||
else
|
||||
err "Invalid version: $v"
|
||||
fi
|
||||
}
|
||||
|
||||
while getopts "hf:t:s:e:i:" OPTION
|
||||
do
|
||||
case ${OPTION} in
|
||||
f)
|
||||
from=${OPTARG}
|
||||
;;
|
||||
t)
|
||||
to=${OPTARG}
|
||||
;;
|
||||
s)
|
||||
start=${OPTARG}
|
||||
;;
|
||||
e)
|
||||
end=${OPTARG}
|
||||
;;
|
||||
i)
|
||||
increase=${OPTARG}
|
||||
if [[ ! "${inc[@]}" =~ ${increase} ]];then
|
||||
err "Only support increasing by one of: ${inc[@]}"
|
||||
fi
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND-1))
|
||||
file=( "$@" )
|
||||
|
||||
if [[ ${#file[@]} -eq 0 ]];then
|
||||
echo "No file specified" >&2
|
||||
usage
|
||||
fi
|
||||
|
||||
if [[ -z "${from}" ]]; then
|
||||
echo "No 'from' version specified." >&2
|
||||
usage
|
||||
fi
|
||||
|
||||
# TODO: compare steps in from_parts and to_parts.
|
||||
version "${from}" from_parts
|
||||
|
||||
if [[ -z "${to}" ]]; then
|
||||
if [[ -z "${increase}" ]]; then
|
||||
err "No 'to' version specified."
|
||||
else
|
||||
case ${increase} in
|
||||
major)
|
||||
to="$(( ${from_parts[0]} + 1 )).0.0"
|
||||
version "$to" to_parts
|
||||
;;
|
||||
minor)
|
||||
to="${from_parts[0]}.$(( ${from_parts[1]} + 1 )).0"
|
||||
version "$to" to_parts
|
||||
;;
|
||||
build)
|
||||
to="${from_parts[0]}.${from_parts[1]}.$(( ${from_parts[2]} + 1 ))"
|
||||
version "$to" to_parts
|
||||
;;
|
||||
snapshot)
|
||||
if [[ true = ${from_parts[3]} ]]; then
|
||||
err "Can't move from SNAPSHOT to SNAPSHOT (from=${from})."
|
||||
else
|
||||
to="${from_parts[0]}.${from_parts[1]}.$(( ${from_parts[2]} + 1 ))-SNAPSHOT"
|
||||
version "$to" to_parts
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
else
|
||||
version "${to}" to_parts
|
||||
fi
|
||||
|
||||
if [[ ${from_parts[3]} = true && ${to_parts[3]} = true ]]; then
|
||||
err "Moving from SNAPSHOT to SNAPSHOT is not supported."
|
||||
fi
|
||||
|
||||
cat <<EOF > sedscript.sed
|
||||
/${start}/,/${end}/{
|
||||
s/${from}/${to}/g
|
||||
}
|
||||
EOF
|
||||
|
||||
d "Moving from=${from} to=${to}"
|
||||
|
||||
trap 'rm -f sedscript.sed' EXIT
|
||||
|
||||
sed_cross() {
|
||||
# Cross-platform sed invocation. OSX has no option to show a version number in sed.
|
||||
local target=$1
|
||||
sed --version >/dev/null 2>&1 && sed -e -i '' -f sedscript.sed "$target" || sed -i '' -E -f sedscript.sed "$target"
|
||||
}
|
||||
|
||||
update_file() {
|
||||
local filename=$1
|
||||
local error_message="ERROR: Failed to update $filename to target version ${to}"
|
||||
local original_hash=$(ruby -r digest -e "p Digest::SHA2.file(\"$filename\").hexdigest")
|
||||
local final_hash=""
|
||||
if ! sed_cross ${filename}; then
|
||||
# occurs if, for example, the file doesn't exist.
|
||||
echo "ERROR: Failed to update $filename to target version ${to}" >&2
|
||||
fi
|
||||
|
||||
local final_hash=$(ruby -r digest -e "p Digest::SHA2.file(\"$filename\").hexdigest")
|
||||
|
||||
if [[ "${original_hash}" = "${final_hash}" ]]; then
|
||||
# occurs if, for example, the file doesn't have expected marker tags for replacement
|
||||
echo "ERROR: $filename was not modified." >&2
|
||||
else
|
||||
echo "Updated $filename successfully!"
|
||||
fi
|
||||
}
|
||||
|
||||
for filename in "${file[@]}"; do
|
||||
update_file ${filename}
|
||||
done
|
||||
|
96
bin/utils/release/release_version_update.sh
Executable file
96
bin/utils/release/release_version_update.sh
Executable file
@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# This script is used to update files to the "latest" version.
|
||||
#
|
||||
# usage: ./bin/utils/release_version_update.sh <from> <to>
|
||||
# example: ./bin/utils/release_version_update.sh 3.0.1-SNAPSHOT 3.0.1
|
||||
#
|
||||
# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
declare cwd=$(cd $(dirname "${BASH_SOURCE}") && pwd)
|
||||
declare root=$(cd "$cwd" && cd ../../../ && pwd)
|
||||
|
||||
USAGE="
|
||||
USAGE: $0 target
|
||||
|
||||
This script will convert the current version in target files to the specified 'target'
|
||||
where target is one of:
|
||||
|
||||
major
|
||||
minor
|
||||
build
|
||||
snapshot
|
||||
|
||||
EXAMPLES:
|
||||
|
||||
Update to new snapshot (1.0.0 -> 1.0.1-SNAPSHOT):
|
||||
$0 snapshot
|
||||
Update build version (1.0.0 -> 1.0.1)
|
||||
$0 build
|
||||
Update minor version (1.2.3 -> 1.3.0)
|
||||
$0 minor
|
||||
Update major version (1.2.3 -> 2.0.0)
|
||||
$0 major
|
||||
"
|
||||
|
||||
version=$(ruby -r rexml/document -e 'include REXML;
|
||||
p XPath.first(Document.new($stdin), "/project/version/text()")' < ${cwd}/../../../pom.xml | tr -d '"')
|
||||
|
||||
if [[ -n "$1" ]]; then
|
||||
case $1 in
|
||||
--help|-h)
|
||||
echo -e "$USAGE" >&2
|
||||
exit 1
|
||||
;;
|
||||
major|minor|build|snapshot)
|
||||
inc="$1"
|
||||
;;
|
||||
*)
|
||||
echo "Invalid target.Must be one of: major minor build or snapshot" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
else
|
||||
inc="snapshot"
|
||||
fi
|
||||
|
||||
echo "Release preparation: Moving from $version to next $inc version."
|
||||
|
||||
# These files should wrap target version replacement blocks with <!-- RELEASE_VERSION --> and <!-- /RELEASE_VERSION -->
|
||||
# We can include xml and md files here.
|
||||
declare -a xml_files=(
|
||||
"${root}/modules/openapi-generator-cli/pom.xml"
|
||||
"${root}/modules/openapi-generator-gradle-plugin/pom.xml"
|
||||
"${root}/modules/openapi-generator-core/pom.xml"
|
||||
"${root}/modules/openapi-generator-maven-plugin/pom.xml"
|
||||
"${root}/modules/openapi-generator-online/pom.xml"
|
||||
"${root}/modules/openapi-generator/pom.xml"
|
||||
"${root}/modules/openapi-generator-maven-plugin/examples/multi-module/java-client/pom.xml"
|
||||
"${root}/modules/openapi-generator-maven-plugin/examples/java-client.xml"
|
||||
"${root}/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml"
|
||||
"${root}/modules/openapi-generator-maven-plugin/examples/non-java.xml"
|
||||
"${root}/samples/meta-codegen/lib/pom.xml"
|
||||
"${root}/pom.xml"
|
||||
)
|
||||
|
||||
# These files should wrap target version replacement blocks with # RELEASE_VERSION and # /RELEASE_VERSION
|
||||
declare -a properties_files=(
|
||||
"${root}/modules/openapi-generator-gradle-plugin/gradle.properties"
|
||||
"${root}/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties"
|
||||
)
|
||||
|
||||
${cwd}/bump.sh -f ${version} -i ${inc} ${xml_files[@]}
|
||||
${cwd}/bump.sh -f ${version} -t ${inc} -s '# RELEASE_VERSION' -e '# \/RELEASE_VERSION' ${properties_files[@]}
|
115
bin/utils/release/release_version_update_docs.sh
Executable file
115
bin/utils/release/release_version_update_docs.sh
Executable file
@ -0,0 +1,115 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# This script is used to update reference files to the "next" version.
|
||||
#
|
||||
# usage: ./bin/utils/release_version_update.sh <from> <to>
|
||||
# example: ./bin/utils/release_version_update.sh 3.0.1 3.0.2
|
||||
#
|
||||
# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
declare cwd=$(cd $(dirname "${BASH_SOURCE}") && pwd)
|
||||
declare root=$(cd "$cwd" && cd ../../../ && pwd)
|
||||
|
||||
USAGE="
|
||||
USAGE: $0 version target
|
||||
|
||||
This script will convert the specified version in DOC target files to the 'target'
|
||||
where target is one of:
|
||||
|
||||
major
|
||||
minor
|
||||
build
|
||||
|
||||
or an explicitly defined version number.
|
||||
|
||||
NOTE:
|
||||
|
||||
Files prepped by this script should never target SNAPSHOT, as the docs should refer to release artifacts.
|
||||
If intending to update to/from snapshots, please add target files to release_version_update.sh instead.
|
||||
|
||||
EXAMPLES:
|
||||
|
||||
Update build version (1.0.0 -> 1.0.1)
|
||||
$0 1.0.0 build
|
||||
Update minor version (1.2.3 -> 1.3.0)
|
||||
$0 1.2.3 minor
|
||||
Update major version (1.2.3 -> 2.0.0)
|
||||
$0 1.2.3 major
|
||||
"
|
||||
|
||||
declare version=$(ruby -r rexml/document -e 'include REXML;
|
||||
p XPath.first(Document.new($stdin), "/project/version/text()")' < ${cwd}/../../../pom.xml | tr -d '"')
|
||||
|
||||
declare target="${2:-build}"
|
||||
declare inc=""
|
||||
declare next_version=""
|
||||
declare ags=""
|
||||
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "Missing argument." >&2
|
||||
echo -e "$USAGE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get version number we're changing
|
||||
case $1 in
|
||||
--help|-h)
|
||||
echo -e "$USAGE" >&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
version="$1"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the target…
|
||||
case ${target} in
|
||||
major|minor|build)
|
||||
inc="$target"
|
||||
;;
|
||||
snapshot)
|
||||
echo -e "Files prepped by this script should never target SNAPSHOT, as the docs should refer to release artifacts.
|
||||
If intending to update to/from snapshots, please add target files to release_version_update.sh instead.
|
||||
" >&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
next_version="$target"
|
||||
;;
|
||||
esac
|
||||
|
||||
ags="-f ${version}"
|
||||
|
||||
if [[ -n "${next_version}" ]];then
|
||||
echo "Release preparation: Moving from $version to ${next_version}."
|
||||
ags="$ags -t ${next_version}"
|
||||
else
|
||||
echo "Release preparation: Moving from $version to next $inc version."
|
||||
ags="$ags -i ${inc}"
|
||||
fi
|
||||
|
||||
declare -a xml_files=(
|
||||
"${root}/modules/openapi-generator-maven-plugin/README.md"
|
||||
"${root}/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md"
|
||||
"${root}/README.md"
|
||||
)
|
||||
|
||||
declare -a commented_files=(
|
||||
"${root}/modules/openapi-generator-gradle-plugin/README.adoc"
|
||||
)
|
||||
|
||||
${cwd}/bump.sh ${ags} ${xml_files[@]}
|
||||
${cwd}/bump.sh ${ags} -s '# RELEASE_VERSION' -e '# \/RELEASE_VERSION' ${commented_files[@]}
|
17
bin/utils/release/testing.txt
Normal file
17
bin/utils/release/testing.txt
Normal file
@ -0,0 +1,17 @@
|
||||
This is a test simple:
|
||||
<!-- RELEASE_VERSION -->3.0.1<!-- /RELEASE_VERSION -->
|
||||
|
||||
Testing with other data:
|
||||
<!-- RELEASE_VERSION -->
|
||||
Version 1.2.3
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
Testing with -SNAPSHOT data:
|
||||
<!-- RELEASE_VERSION -->
|
||||
Version 2.3.4-SNAPSHOT
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
Testing with a value not to be replaced:
|
||||
<!-- RELEASE_VERSION -->
|
||||
Version 3.2.2
|
||||
<!-- /RELEASE_VERSION -->
|
17
bin/utils/release/testing2.txt
Normal file
17
bin/utils/release/testing2.txt
Normal file
@ -0,0 +1,17 @@
|
||||
This is a test simple:
|
||||
<!-- RELEASE_VERSION -->3.0.1<!-- /RELEASE_VERSION -->
|
||||
|
||||
Testing with other data:
|
||||
<!-- RELEASE_VERSION -->
|
||||
Version 1.2.3
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
Testing with -SNAPSHOT data:
|
||||
<!-- RELEASE_VERSION -->
|
||||
Version 2.3.4-SNAPSHOT
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
Testing with a value not to be replaced:
|
||||
<!-- RELEASE_VERSION -->
|
||||
Version 3.2.2
|
||||
<!-- /RELEASE_VERSION -->
|
@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# usage: ./bin/utils/release_version_update.sh 3.0.1-SNAPSHOT 3.0.1
|
||||
#
|
||||
# Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
if [[ "$1" != "" ]]; then
|
||||
FROM="$1"
|
||||
else
|
||||
echo "Missing argument. Usage e.g.: ./bin/utils/release_version_update.sh 3.0.1-SNAPSHOT 3.0.1"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [[ "$2" != "" ]]; then
|
||||
TO="$2"
|
||||
else
|
||||
echo "Missing argument. Usage e.g.: ./bin/utils/release_version_update.sh 3.0.1-SNAPSHOT 3.0.1"
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
echo "Release preparation: replacing $FROM with $TO in different files"
|
||||
|
||||
# This script assumes the files defined here have a version surrounded by angle brackets within an xml node.
|
||||
# For example, >4.0.0< becomes >4.0.1-SNAPSHOT<.
|
||||
# Verify the sed command below against a file before adding here.
|
||||
declare -a files=("modules/openapi-generator-cli/pom.xml"
|
||||
"modules/openapi-generator-gradle-plugin/pom.xml"
|
||||
"modules/openapi-generator-core/pom.xml"
|
||||
"modules/openapi-generator-maven-plugin/pom.xml"
|
||||
"modules/openapi-generator-online/pom.xml"
|
||||
"modules/openapi-generator/pom.xml"
|
||||
"samples/meta-codegen/lib/pom.xml"
|
||||
"pom.xml")
|
||||
|
||||
sedi () {
|
||||
# Cross-platform version of sed -i that works both on Mac and Linux
|
||||
sed --version >/dev/null 2>&1 && sed -i -e "$@" || sed -i "" "$@"
|
||||
}
|
||||
|
||||
for filename in "${files[@]}"; do
|
||||
# e.g. sed -i '' "s/3.0.1-SNAPSHOT/3.0.1/g" CI/pom.xml.bash
|
||||
#echo "Running command: sed -i '' "s/$FROM/$TO/g" $filename"
|
||||
if sedi "s/>$FROM</>$TO</g" $filename; then
|
||||
echo "Updated $filename successfully!"
|
||||
else
|
||||
echo "ERROR: Failed to update $filename with the following command"
|
||||
echo "sed -i '' \"s/$FROM/$TO/g\" $filename"
|
||||
fi
|
||||
done
|
@ -3,7 +3,9 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -5,7 +5,9 @@
|
||||
<parent>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -40,6 +40,8 @@ compileJava.dependsOn tasks.openApiGenerate
|
||||
|
||||
== Plugin Setup
|
||||
|
||||
//# RELEASE_VERSION
|
||||
|
||||
[source,group]
|
||||
----
|
||||
plugins {
|
||||
@ -65,6 +67,7 @@ buildscript {
|
||||
|
||||
apply plugin: 'org.openapi.generator'
|
||||
----
|
||||
//# /RELEASE_VERSION
|
||||
|
||||
== Configuration
|
||||
|
||||
@ -597,6 +600,7 @@ Android Studio may experience a Windows-specific Guava dependency conflict with
|
||||
|
||||
As a workaround, you may force exclude conflicting Guava dependencies.
|
||||
|
||||
//# RELEASE_VERSION
|
||||
```gradle
|
||||
buildscript {
|
||||
repositories {
|
||||
@ -618,5 +622,6 @@ configurations {
|
||||
// …
|
||||
apply plugin: 'org.openapi.generator'
|
||||
```
|
||||
//# /RELEASE_VERSION
|
||||
|
||||
See https://github.com/OpenAPITools/openapi-generator/issues/1818[OpenAPITools/openapi-generator#1818] for more details.
|
||||
|
@ -1,4 +1,6 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=4.0.3-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
||||
# BEGIN placeholders
|
||||
# these are just placeholders to allow contributors to build directly
|
||||
|
@ -3,7 +3,9 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
@ -1 +1,3 @@
|
||||
# RELEASE_VERSION
|
||||
openApiGeneratorVersion=4.0.3-SNAPSHOT
|
||||
# /RELEASE_VERSION
|
||||
|
@ -11,7 +11,9 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase)
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
@ -12,7 +12,9 @@
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
@ -18,7 +18,9 @@
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>${project.groupId}</groupId>
|
||||
|
@ -12,7 +12,9 @@
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
@ -12,7 +12,9 @@
|
||||
<plugin>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
|
@ -4,7 +4,9 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>openapi-generator-maven-plugin</artifactId>
|
||||
|
@ -3,7 +3,9 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>openapi-generator-online</artifactId>
|
||||
|
@ -3,7 +3,9 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
2
pom.xml
2
pom.xml
@ -9,7 +9,9 @@
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>openapi-generator-project</name>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>4.0.3-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<url>https://github.com/openapitools/openapi-generator</url>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:openapitools/openapi-generator.git</connection>
|
||||
|
Loading…
x
Reference in New Issue
Block a user