mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-11 02:33:51 +08:00
fix: Use commit SHA as version for development builds instead of 'latest'
**Problem**:
- version.json showed "version": "latest" for dev builds
- Non-descriptive and not useful for version tracking
**Solution**:
- Use "dev-{commit_sha}" format for development builds
- Stable releases: "3.4.1" (from tag)
- Development builds: "dev-4ec1a17" (from commit SHA)
- API failure fallback: "dev-unknown"
**Version Format Examples**:
```json
// Stable release
{"version": "3.4.1", "commit_sha": "4ec1a17"}
// Development build
{"version": "dev-4ec1a17", "commit_sha": "4ec1a17"}
```
**Benefits**:
- Clear distinction between stable and dev versions
- version field always contains meaningful information
- No more "latest" placeholder values
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -564,27 +564,8 @@ function Main {
|
|||||||
throw "Extraction failed"
|
throw "Extraction failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine version and branch information to pass
|
# Get commit SHA from the downloaded repository first
|
||||||
$versionToPass = ""
|
|
||||||
$commitSha = ""
|
$commitSha = ""
|
||||||
|
|
||||||
if ($Tag) {
|
|
||||||
# Specific tag version
|
|
||||||
$versionToPass = $Tag -replace '^v', '' # Remove 'v' prefix
|
|
||||||
} elseif ($Version -eq "stable") {
|
|
||||||
# Auto-detected latest stable
|
|
||||||
$latestTag = Get-LatestRelease
|
|
||||||
if ($latestTag) {
|
|
||||||
$versionToPass = $latestTag -replace '^v', ''
|
|
||||||
} else {
|
|
||||||
$versionToPass = "latest"
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
# Latest development or branch
|
|
||||||
$versionToPass = "latest"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Get commit SHA from the downloaded repository
|
|
||||||
try {
|
try {
|
||||||
Push-Location $repoDir
|
Push-Location $repoDir
|
||||||
$commitSha = (git rev-parse --short HEAD 2>$null)
|
$commitSha = (git rev-parse --short HEAD 2>$null)
|
||||||
@@ -602,6 +583,26 @@ function Main {
|
|||||||
$commitSha = "unknown"
|
$commitSha = "unknown"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Determine version and branch information to pass
|
||||||
|
$versionToPass = ""
|
||||||
|
|
||||||
|
if ($Tag) {
|
||||||
|
# Specific tag version
|
||||||
|
$versionToPass = $Tag -replace '^v', '' # Remove 'v' prefix
|
||||||
|
} elseif ($Version -eq "stable") {
|
||||||
|
# Auto-detected latest stable
|
||||||
|
$latestTag = Get-LatestRelease
|
||||||
|
if ($latestTag) {
|
||||||
|
$versionToPass = $latestTag -replace '^v', ''
|
||||||
|
} else {
|
||||||
|
# Fallback: use commit SHA as version
|
||||||
|
$versionToPass = "dev-$commitSha"
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
# Latest development or branch - use commit SHA as version
|
||||||
|
$versionToPass = "dev-$commitSha"
|
||||||
|
}
|
||||||
|
|
||||||
$branchToPass = if ($Version -eq "branch") { $Branch } elseif ($Version -eq "latest") { "main" } elseif ($Tag) { $Tag } else { "main" }
|
$branchToPass = if ($Version -eq "branch") { $Branch } elseif ($Version -eq "latest") { "main" } elseif ($Tag) { $Tag } else { "main" }
|
||||||
|
|
||||||
Write-ColorOutput "Version info: $versionToPass (branch: $branchToPass, commit: $commitSha)" $ColorInfo
|
Write-ColorOutput "Version info: $versionToPass (branch: $branchToPass, commit: $commitSha)" $ColorInfo
|
||||||
|
|||||||
@@ -648,10 +648,21 @@ function main() {
|
|||||||
if [ $extract_status -eq 0 ] && [ -n "$repo_dir" ] && [ -d "$repo_dir" ]; then
|
if [ $extract_status -eq 0 ] && [ -n "$repo_dir" ] && [ -d "$repo_dir" ]; then
|
||||||
write_color "Extraction successful: $repo_dir" "$COLOR_SUCCESS"
|
write_color "Extraction successful: $repo_dir" "$COLOR_SUCCESS"
|
||||||
|
|
||||||
|
# Get commit SHA from the downloaded repository first
|
||||||
|
local commit_sha=""
|
||||||
|
if command -v git &> /dev/null && [ -d "$repo_dir/.git" ]; then
|
||||||
|
commit_sha=$(cd "$repo_dir" && git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
||||||
|
else
|
||||||
|
# Fallback: try to get from GitHub API
|
||||||
|
local temp_branch="main"
|
||||||
|
[ "$VERSION_TYPE" = "branch" ] && temp_branch="$BRANCH"
|
||||||
|
commit_sha=$(curl -fsSL "https://api.github.com/repos/catlog22/Claude-Code-Workflow/commits/$temp_branch" 2>/dev/null | grep -o '"sha": *"[^"]*"' | head -1 | cut -d'"' -f4 | cut -c1-7)
|
||||||
|
[ -z "$commit_sha" ] && commit_sha="unknown"
|
||||||
|
fi
|
||||||
|
|
||||||
# Determine version and branch information to pass
|
# Determine version and branch information to pass
|
||||||
local version_to_pass=""
|
local version_to_pass=""
|
||||||
local branch_to_pass=""
|
local branch_to_pass=""
|
||||||
local commit_sha=""
|
|
||||||
|
|
||||||
if [ -n "$TAG_VERSION" ]; then
|
if [ -n "$TAG_VERSION" ]; then
|
||||||
# Specific tag version - remove 'v' prefix
|
# Specific tag version - remove 'v' prefix
|
||||||
@@ -663,11 +674,12 @@ function main() {
|
|||||||
if [ -n "$latest_tag" ]; then
|
if [ -n "$latest_tag" ]; then
|
||||||
version_to_pass="${latest_tag#v}"
|
version_to_pass="${latest_tag#v}"
|
||||||
else
|
else
|
||||||
version_to_pass="latest"
|
# Fallback: use commit SHA as version
|
||||||
|
version_to_pass="dev-$commit_sha"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Latest development or branch
|
# Latest development or branch - use commit SHA as version
|
||||||
version_to_pass="latest"
|
version_to_pass="dev-$commit_sha"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$VERSION_TYPE" = "branch" ]; then
|
if [ "$VERSION_TYPE" = "branch" ]; then
|
||||||
@@ -680,15 +692,6 @@ function main() {
|
|||||||
branch_to_pass="main"
|
branch_to_pass="main"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get commit SHA from the downloaded repository
|
|
||||||
if command -v git &> /dev/null && [ -d "$repo_dir/.git" ]; then
|
|
||||||
commit_sha=$(cd "$repo_dir" && git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
|
||||||
else
|
|
||||||
# Fallback: try to get from GitHub API
|
|
||||||
commit_sha=$(curl -fsSL "https://api.github.com/repos/catlog22/Claude-Code-Workflow/commits/$branch_to_pass" 2>/dev/null | grep -o '"sha": *"[^"]*"' | head -1 | cut -d'"' -f4 | cut -c1-7)
|
|
||||||
[ -z "$commit_sha" ] && commit_sha="unknown"
|
|
||||||
fi
|
|
||||||
|
|
||||||
write_color "Version info: $version_to_pass (branch: $branch_to_pass, commit: $commit_sha)" "$COLOR_INFO"
|
write_color "Version info: $version_to_pass (branch: $branch_to_pass, commit: $commit_sha)" "$COLOR_INFO"
|
||||||
|
|
||||||
# Run local installer with version information
|
# Run local installer with version information
|
||||||
|
|||||||
Reference in New Issue
Block a user