Skip to content

Commit 85a31a8

Browse files
committed
chore: Simplify release workflow by replacing inline scripts with dedicated PowerShell scripts for checking GoReleaser output and fixing Scoop manifest
1 parent 9f941db commit 85a31a8

File tree

1 file changed

+3
-103
lines changed

1 file changed

+3
-103
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -36,113 +36,13 @@ jobs:
3636
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
3737

3838
- name: Check what GoReleaser created
39-
run: |
40-
Write-Host "📁 Checking dist directory contents..."
41-
if (Test-Path 'dist') {
42-
Write-Host "✅ dist folder exists!"
43-
Get-ChildItem -Path 'dist' -Recurse | Select-Object FullName, Length
44-
} else {
45-
Write-Host "❌ dist folder not found!"
46-
}
47-
48-
Write-Host ""
49-
Write-Host "🔍 Looking for scoop manifest..."
50-
if (Test-Path 'dist/scoop/zed-cli-win-unofficial.json') {
51-
Write-Host "✅ Scoop manifest found!"
52-
Write-Host "📦 Original manifest contents:"
53-
Get-Content 'dist/scoop/zed-cli-win-unofficial.json' | Write-Host
54-
} else {
55-
Write-Host "❌ Scoop manifest not found in expected location"
56-
Write-Host "📁 Checking what's in dist/scoop/:"
57-
if (Test-Path 'dist/scoop') {
58-
Get-ChildItem 'dist/scoop' | Write-Host
59-
} else {
60-
Write-Host "❌ dist/scoop directory doesn't exist"
61-
}
62-
}
39+
run: ./scripts/check-goreleaser-output.ps1
6340
shell: powershell
6441

6542
- name: Fix Scoop Manifest (Test - Log Only)
66-
run: |
67-
Write-Host "🔧 Testing scoop manifest fix..."
68-
69-
if (Test-Path 'dist/scoop/zed-cli-win-unofficial.json') {
70-
Write-Host "✅ Found scoop manifest, reading contents..."
71-
72-
# Read the original content as text to preserve formatting
73-
$content = Get-Content 'dist/scoop/zed-cli-win-unofficial.json' -Raw
74-
75-
Write-Host "📄 Original manifest:"
76-
Write-Host $content
77-
78-
# Parse JSON to check current bin array (for logging only)
79-
$manifest = $content | ConvertFrom-Json
80-
Write-Host ""
81-
Write-Host "📋 Current bin array:"
82-
$manifest.architecture."64bit".bin | ForEach-Object { Write-Host " - $_" }
83-
84-
# Use regex to find and modify the bin array while preserving formatting
85-
# This looks for the bin array pattern and adds zed.bat if not already present
86-
if ($content -notmatch '"zed-cli-win-unofficial/zed\.bat"') {
87-
Write-Host ""
88-
Write-Host "🔧 Adding zed.bat to bin array..."
89-
90-
# Find the bin array and add the new entry
91-
# Pattern matches: "bin": ["existing-entry"] or "bin": ["entry1", "entry2"]
92-
$pattern = '("bin":\s*\[\s*"[^"]+")(\s*\])'
93-
$replacement = '$1, "zed-cli-win-unofficial/zed.bat"$2'
94-
95-
$updatedContent = $content -replace $pattern, $replacement
96-
97-
Write-Host "📄 Updated manifest:"
98-
Write-Host $updatedContent
99-
100-
# Create bucket directory for testing
101-
if (-not (Test-Path 'bucket')) {
102-
New-Item -ItemType Directory -Path 'bucket'
103-
Write-Host ""
104-
Write-Host "📁 Created bucket directory (for testing)"
105-
}
106-
107-
# Save the updated manifest with preserved formatting
108-
$updatedContent | Set-Content 'bucket/zed-cli-win-unofficial.json' -NoNewline
109-
Write-Host ""
110-
Write-Host "💾 Saved updated manifest to bucket/ (for testing)"
111-
Write-Host "✅ Scoop manifest fix test successful!"
112-
113-
}
114-
else {
115-
Write-Host ""
116-
Write-Host "✅ zed.bat already exists in bin array"
117-
}
118-
119-
}
120-
else {
121-
Write-Host "❌ Scoop manifest not found"
122-
exit 1
123-
}
43+
run: ./scripts/fix-scoop-manifest.ps1
12444
shell: powershell
12545

12646
- name: Show what would be committed
127-
run: |
128-
Write-Host "📊 Summary of what would be committed to repository:"
129-
Write-Host ""
130-
131-
if (Test-Path 'bucket/zed-cli-win-unofficial.json') {
132-
Write-Host "✅ bucket/zed-cli-win-unofficial.json"
133-
Write-Host " Size: $((Get-Item 'bucket/zed-cli-win-unofficial.json').Length) bytes"
134-
Write-Host ""
135-
Write-Host "📄 File contents that would be committed:"
136-
Get-Content 'bucket/zed-cli-win-unofficial.json' | Write-Host
137-
} else {
138-
Write-Host "❌ No manifest file to commit"
139-
}
140-
141-
Write-Host ""
142-
Write-Host "🚀 In a real release, this would:"
143-
Write-Host " 1. Create/update bucket/zed-cli-win-unofficial.json"
144-
Write-Host " 2. Commit with message: 'Scoop update for zed-cli-win-unofficial version ${{ github.ref_name }}'"
145-
Write-Host " 3. Push to main branch"
146-
Write-Host ""
147-
Write-Host "ℹ️ To enable actual committing, update the workflow to include git commands"
47+
run: ./scripts/show-commit-summary.ps1
14848
shell: powershell

0 commit comments

Comments
 (0)