mirror of
https://github.com/cline/cline.git
synced 2026-09-01 15:11:04 +08:00
WIP: Release Scripts
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"claude-dev": minor
|
||||
---
|
||||
|
||||
Test Minor
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"claude-dev": patch
|
||||
---
|
||||
|
||||
Test Patch
|
||||
@@ -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}")
|
||||
|
||||
@@ -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 }}
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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 }}
|
||||
Reference in New Issue
Block a user