From 05d76f01a600730c83dca1bd524bab6519ff6321 Mon Sep 17 00:00:00 2001 From: Andrzej Danilowski Date: Wed, 13 May 2026 11:39:49 +0200 Subject: [PATCH 1/2] Adjust release script --- README.md | 17 ++++++------ copy-sdks => bake-sdk-release | 49 +++++++++++++++++++++-------------- 2 files changed, 38 insertions(+), 28 deletions(-) rename copy-sdks => bake-sdk-release (84%) diff --git a/README.md b/README.md index 7b1abddb4..e7ac84992 100644 --- a/README.md +++ b/README.md @@ -84,25 +84,24 @@ Changes will appear against the [/sdks](sdks) directory. Make sure to include th ### Releasing SDKs -The [copy-sdks](copy-sdks) script copies built SDK files from [/sdks](sdks) into the [/repos](repos) directory, updates version numbers, commits, and pushes a release branch. +The [bake-sdk-release](bake-sdk-release) script copies built SDK files from [/sdks](sdks) into the [/repos](repos) directory, updates version numbers, commits, and pushes a release branch. You can release a single SDK with an explicit version: ```bash -./copy-sdks -t php -v 1.4.0 +./bake-sdk-release -t php -v 1.4.0 ``` -Or release multiple SDKs at once, with automatic version bumps (reads the current version from `repos/[SDK]/VERSION`): +Or release multiple SDKs at once. Without `-b` or `-v`, the current version from `repos/[SDK]/VERSION` is used as-is: ```bash -./copy-sdks -t python,node,ruby # specific SDKs, auto-bump minor -./copy-sdks -t all # all SDKs, auto-bump minor -./copy-sdks -t all -b patch # all SDKs, auto-bump patch -./copy-sdks -t all -b major # all SDKs, auto-bump major -./copy-sdks -t all -v 2.0.0 # all SDKs, explicit version +./bake-sdk-release -t all # all SDKs, keep current version +./bake-sdk-release -t all -b minor # all SDKs, bump minor +./bake-sdk-release -t all -b patch # all SDKs, bump patch +./bake-sdk-release -t all -v 2.0.0 # all SDKs, explicit version ``` -The `-b` flag accepts `major`, `minor` (default), or `patch`. +The `-b` flag accepts `major`, `minor`, or `patch`. The script shows a summary table of current and new versions and asks for confirmation before proceeding. diff --git a/copy-sdks b/bake-sdk-release similarity index 84% rename from copy-sdks rename to bake-sdk-release index 34f1186cd..5d8d86c30 100755 --- a/copy-sdks +++ b/bake-sdk-release @@ -7,7 +7,8 @@ SDKS=( dotnet java-v1 java-v2 node php python ruby ) SHOW_HELP=0 TARGET_SDK= TARGET_VERSION= -BUMP_TYPE=minor +BUMP_TYPE= +DRY_RUN=0 REPO_DOTNET="https://github.com/hellosign/dropbox-sign-dotnet.git" REPO_JAVA_V1="--branch v1 https://github.com/hellosign/dropbox-sign-java.git" @@ -19,7 +20,7 @@ REPO_RUBY="https://github.com/hellosign/dropbox-sign-ruby.git" REPO_MAIN_BRANCH="main" -while getopts ":t:v:b:h" opt; do +while getopts ":t:v:b:dh" opt; do case $opt in t) TARGET_SDK="$OPTARG" ;; @@ -27,6 +28,8 @@ while getopts ":t:v:b:h" opt; do ;; b) BUMP_TYPE="$OPTARG" ;; + d) DRY_RUN=1 + ;; h) SHOW_HELP=1 ;; \?) echo "Invalid option -$OPTARG" >&2 @@ -95,8 +98,10 @@ function main() { if [[ -n "${TARGET_VERSION}" ]]; then versions+=("${TARGET_VERSION}") - else + elif [[ -n "${BUMP_TYPE}" ]]; then versions+=("$(bump_version "$current_ver" "$BUMP_TYPE")") + else + versions+=("${current_ver}") fi done @@ -136,7 +141,7 @@ function main() { function show_help() { cat << EOF -Usage: copy-sdks [OPTION] +Usage: bake-sdk-release [OPTION] Copies build files for a given SDK into the repos/[SDK] directory. **WARNING** All files and directories present in the repos/[SDK] directory will @@ -146,15 +151,17 @@ Copies build files for a given SDK into the repos/[SDK] directory. valid: dotnet, java-v1, java-v2, node, php, python, ruby, all -v version of the SDK, ex: 1.4.0 if omitted, auto-bumps version from repos/[SDK]/VERSION --b bump type when -v is omitted: major, minor (default), or patch +-b bump version: major, minor, or patch + if omitted, uses current version from repos/[SDK]/VERSION +-d dry run: copy files and update versions but skip commit and push -h display this help and exit Examples: - copy-sdks -t php -v 1.4.0 # single SDK, explicit version - copy-sdks -t python,node,ruby # multiple SDKs, auto-bump minor - copy-sdks -t all # all SDKs, auto-bump minor - copy-sdks -t all -b patch # all SDKs, auto-bump patch - copy-sdks -t all -v 2.0.0 # all SDKs, same explicit version + bake-sdk-release -t php -v 1.4.0 # single SDK, explicit version + bake-sdk-release -t all -b minor # all SDKs, bump minor + bake-sdk-release -t all -b patch # all SDKs, bump patch + bake-sdk-release -t all # all SDKs, keep current version + bake-sdk-release -t python,node,ruby # specific SDKs, keep current version EOF exit 0 @@ -193,10 +200,12 @@ function copy_files() printf "Copying built files for the ${SDK} SDK to ${SDK_DIR}\n" pushd "${SDK_DIR}/" - git reset --hard origin/${REPO_MAIN_BRANCH} - git pull origin ${REPO_MAIN_BRANCH} - git checkout "release-${VERSION}" 2>/dev/null || git checkout -b "release-${VERSION}" - git rm -rf --cached . + git fetch origin + git checkout "release-${VERSION}" 2>/dev/null || { + git checkout ${REPO_MAIN_BRANCH} + git reset --hard origin/${REPO_MAIN_BRANCH} + git checkout -b "release-${VERSION}" + } popd @@ -207,8 +216,6 @@ function copy_files() pushd "${SDK_DIR}/" - git add . - rm -f "${SDK_DIR}/openapi-sdk.yaml" rm -rf "${SDK_DIR}/examples" mkdir -p "${SDK_DIR}/examples" @@ -233,9 +240,13 @@ function copy_files() php "${DIR}/bin/update-sdk-version.php" ${SDK} ${VERSION} - git add -A - git commit -m "Release ${VERSION}" - git push -u origin "release-${VERSION}" + if [[ "${DRY_RUN}" -eq 0 ]]; then + git add -A + git commit -m "Release ${VERSION}" + git push -u origin "release-${VERSION}" + else + printf "Dry run: skipping commit and push for %s\n" "$SDK" + fi popd } From 00645843903c45fcf0d7958c03e74ff88fa25dd6 Mon Sep 17 00:00:00 2001 From: Andrzej Danilowski Date: Wed, 13 May 2026 11:59:25 +0200 Subject: [PATCH 2/2] Adjust release script --- bin/copy-examples-filtered | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bin/copy-examples-filtered b/bin/copy-examples-filtered index 424a9b809..82367c82e 100755 --- a/bin/copy-examples-filtered +++ b/bin/copy-examples-filtered @@ -31,6 +31,10 @@ for FILE in "${SRC_DIR}"/*."${EXT}"; do [ -f "$FILE" ] || continue BASENAME=$(basename "$FILE" ".$EXT") + if [[ "$BASENAME" != *Example ]]; then + continue + fi + SKIP=0 for PASCAL in "${HIDDEN_PASCALS[@]}"; do if [ "$BASENAME" = "${PASCAL}Example" ]; then