From bbd0b4d674730165bdaafb1015ad78fc3c292d85 Mon Sep 17 00:00:00 2001 From: Dennis Bartlett Date: Mon, 17 Mar 2025 00:07:50 -0700 Subject: [PATCH] WIP: Release Scripts --- .changeset/.mighty-tools-remain.md | 7 -- .changeset/rotten-ghosts-eat.md | 5 ++ .changeset/spotty-bats-deliver.md | 5 ++ .../scripts/overwrite_changeset_changelog.py | 69 ++++++++++++++----- .github/workflows/publish.yml | 60 +++++++++------- CHANGELOG.md | 6 ++ .../check-changeset.yml | 2 +- .../workflows => disabled_workflows}/test.yml | 0 8 files changed, 105 insertions(+), 49 deletions(-) delete mode 100644 .changeset/.mighty-tools-remain.md create mode 100644 .changeset/rotten-ghosts-eat.md create mode 100644 .changeset/spotty-bats-deliver.md rename {.github/workflows => disabled_workflows}/check-changeset.yml (98%) rename {.github/workflows => disabled_workflows}/test.yml (100%) diff --git a/.changeset/.mighty-tools-remain.md b/.changeset/.mighty-tools-remain.md deleted file mode 100644 index b66bf2073e..0000000000 --- a/.changeset/.mighty-tools-remain.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -"claude-dev": minor ---- -Add Bedrock prompt caching support (optional). - -This feature protected under checkbox because it is not yet rolled out to everyone, and if you will try to send cache headers, and its not enabled for you, you will get error. - diff --git a/.changeset/rotten-ghosts-eat.md b/.changeset/rotten-ghosts-eat.md new file mode 100644 index 0000000000..4ac71e9b3a --- /dev/null +++ b/.changeset/rotten-ghosts-eat.md @@ -0,0 +1,5 @@ +--- +"claude-dev": minor +--- + +Test Minor diff --git a/.changeset/spotty-bats-deliver.md b/.changeset/spotty-bats-deliver.md new file mode 100644 index 0000000000..6c3a0c0c43 --- /dev/null +++ b/.changeset/spotty-bats-deliver.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Test Patch diff --git a/.github/scripts/overwrite_changeset_changelog.py b/.github/scripts/overwrite_changeset_changelog.py index 67fdb6a647..cac054d50f 100644 --- a/.github/scripts/overwrite_changeset_changelog.py +++ b/.github/scripts/overwrite_changeset_changelog.py @@ -26,39 +26,65 @@ import sys CHANGELOG_PATH = os.environ.get("CHANGELOG_PATH", "CHANGELOG.md") VERSION = os.environ['VERSION'] -PREV_VERSION = os.environ.get("PREV_VERSION", "") NEW_CONTENT = os.environ.get("NEW_CONTENT", "") -def overwrite_changelog_section(changelog_text: str, new_content: str): - # Find the section for the specified version - version_pattern = f"## {VERSION}\n" - bracketed_version_pattern = f"## [{VERSION}]\n" - prev_version_pattern = f"## [{PREV_VERSION}]\n" - print(f"latest version: {VERSION}") - print(f"prev_version: {PREV_VERSION}") +# Find the section for the specified version +version_index = -1 +version_pattern = f"## {VERSION}\n" +bracketed_version_pattern = f"## [{VERSION}]\n" +header_end_index = 0 +print(f"latest version: {VERSION}") + +def fetch_changelog_header(changelog_text: str): + global version_pattern, version_index, bracketed_version_pattern, header_end_index + header = "" + print(f"Starting fetch_changelog_header") # Try both unbracketed and bracketed version patterns version_index = changelog_text.find(version_pattern) if version_index == -1: + print("Version not found, trying bracketed version pattern") version_index = changelog_text.find(bracketed_version_pattern) if version_index == -1: + print("Bracketed version not found, adding new version header") # If version not found, add it at the top (after the first line) first_newline = changelog_text.find('\n') + print(f"First newline index: {first_newline}") if first_newline == -1: + print("No newline found, prepending new version header") # If no newline found, just prepend - return f"## [{VERSION}]\n\n{changelog_text}" - return f"{changelog_text[:first_newline + 1]}## [{VERSION}]\n\n{changelog_text[first_newline + 1:]}" + header = f"## [{VERSION}]\n\n" + header = f"{changelog_text[:first_newline + 1]}\n## [{VERSION}]\n\n" else: # Using bracketed version version_pattern = bracketed_version_pattern + header = changelog_text[:version_index] + else: + header = changelog_text[:version_index] + + header_end_index = len(header) + return header - notes_start_index = version_index + len(version_pattern) - notes_end_index = changelog_text.find(prev_version_pattern, notes_start_index) if PREV_VERSION and prev_version_pattern in changelog_text else len(changelog_text) + +def generate_changelog_section(changelog_text: str, new_content: str): + + global version_pattern, version_index, header_end_index + print(f"Starting generate_changelog_section") + print(f"Version index: {version_index}") + print(f"Version pattern: {version_pattern} {len(version_pattern)}") + print(f"Header end index: {header_end_index}") + + prev_version_pattern = "## [" + prev_version_index = changelog_text[header_end_index:].find(prev_version_pattern) + print(f"Previous version index: {prev_version_index}") if new_content: - return changelog_text[:notes_start_index] + f"{new_content}\n" + changelog_text[notes_end_index:] + print("Detected new content, overwriting existing changeset") + return f"{new_content}\n" + changelog_text[prev_version_index:] else: - changeset_lines = changelog_text[notes_start_index:notes_end_index].split("\n") + print("No new content provided, reformatting existing changeset") + changeset_lines = changelog_text[header_end_index:prev_version_index].split("\n") + print(f"Changeset lines: {changeset_lines}") # Ensure we have at least 2 lines before removing them if len(changeset_lines) < 2: print("Warning: Changeset content has fewer than 2 lines") @@ -66,11 +92,22 @@ def overwrite_changelog_section(changelog_text: str, new_content: str): else: # Remove the first two lines from the regular changeset format, ex: \n### Patch Changes parsed_lines = "\n".join(changeset_lines[2:]) - updated_changelog = changelog_text[:notes_start_index] + parsed_lines + changelog_text[notes_end_index:] + + # Reconstruct the changelog with the new content + updated_changelog = parsed_lines + changelog_text[prev_version_index:] # Ensure version number is bracketed updated_changelog = updated_changelog.replace(f"## {VERSION}", f"## [{VERSION}]") return updated_changelog + +def overwrite_changelog_section(changelog_text: str, new_content: str): + print(f"Starting overwrite_changelog_section") + header = fetch_changelog_header(changelog_text) + body = generate_changelog_section(changelog_text, new_content) + print(f"Header: {header}") + return header + body + + try: print(f"Reading changelog from: {CHANGELOG_PATH}") with open(CHANGELOG_PATH, 'r') as f: @@ -85,7 +122,7 @@ try: print("New changelog content:") print("----------------------------------------------------------------------------------") - print(new_changelog) + # print(new_changelog) print("----------------------------------------------------------------------------------") print(f"Writing updated changelog back to: {CHANGELOG_PATH}") diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 88388fac7e..4418a26559 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,7 +6,7 @@ on: release-type: description: "Choose release type (release or pre-release)" required: true - default: "release" + default: "pre-release" type: choice options: - pre-release @@ -19,11 +19,11 @@ permissions: pull-requests: write jobs: - test: - uses: ./.github/workflows/test.yml + # test: + # uses: ./.github/workflows/test.yml publish: - needs: test + # needs: test name: Publish Extension runs-on: ubuntu-latest environment: publish @@ -75,8 +75,8 @@ jobs: VERSION=v${{ steps.get_version.outputs.version }} echo "tag=$VERSION" >> $GITHUB_OUTPUT echo "Tagging with $VERSION" - git tag "$VERSION" - git push origin "$VERSION" + # git tag "$VERSION" + # git push origin "$VERSION" - name: Package and Publish Extension env: @@ -87,29 +87,39 @@ jobs: vsce package --out "cline-${{ steps.get_version.outputs.version }}.vsix" if [ "${{ github.event.inputs.release-type }}" = "pre-release" ]; then - npm run publish:marketplace:prerelease + # npm run publish:marketplace:prerelease echo "Successfully published pre-release version ${{ steps.get_version.outputs.version }} to VS Code Marketplace and Open VSX Registry" else - npm run publish:marketplace + # npm run publish:marketplace echo "Successfully published release version ${{ steps.get_version.outputs.version }} to VS Code Marketplace and Open VSX Registry" fi - # - name: Get Changelog Entry - # id: changelog - # uses: mindsers/changelog-reader-action@v2 - # with: - # # This expects a standard Keep a Changelog format - # # "latest" means it will read whichever is the most recent version - # # set in "## [1.2.3] - 2025-01-28" style - # version: latest + # - name: Create Changelog Entry + # id: changesets + # uses: changesets/action@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create GitHub Release - uses: softprops/action-gh-release@v1 - with: - tag_name: ${{ steps.create_tag.outputs.tag }} - files: "*.vsix" - # body: ${{ steps.changelog.outputs.content }} - generate_release_notes: true - prerelease: ${{ github.event.inputs.release-type == 'pre-release' }} + - name: Create Changelog Entry + id: changesets env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + VERSION: ${{ steps.get_version.outputs.version }} + run: | + python .github/scripts/overwrite_changeset_changelog.py + + - name: Get Changelog Entry + id: changelog + uses: mindsers/changelog-reader-action@v2 + with: + version: ${{ steps.get_version.outputs.version }} + + # - name: Create GitHub Release + # uses: softprops/action-gh-release@v1 + # with: + # tag_name: ${{ steps.create_tag.outputs.tag }} + # files: "*.vsix" + # # body: ${{ steps.fetch-changelog.outputs.content }} + # generate_release_notes: true + # prerelease: ${{ github.event.inputs.release-type == 'pre-release' }} + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c08d83b3b..e1ace8b0ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## [3.7.1] + +- Tests +- Tests +- Tests + ## [3.7.0] - Cline now displays selectable options when asking questions or presenting a plan, saving you from having to type out responses! diff --git a/.github/workflows/check-changeset.yml b/disabled_workflows/check-changeset.yml similarity index 98% rename from .github/workflows/check-changeset.yml rename to disabled_workflows/check-changeset.yml index f220257c89..5d58431d65 100644 --- a/.github/workflows/check-changeset.yml +++ b/disabled_workflows/check-changeset.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + uses: actions/checkout@v4 with: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/test.yml b/disabled_workflows/test.yml similarity index 100% rename from .github/workflows/test.yml rename to disabled_workflows/test.yml