Skip to content

chore: Enable upload during testing in GoReleaser configuration #9

chore: Enable upload during testing in GoReleaser configuration

chore: Enable upload during testing in GoReleaser configuration #9

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
goreleaser:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: 1.24.1
- name: Verify Chocolatey Installation
run: choco --version
- name: Run GoReleaser (without scoop publishing)
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: "~> v2"
args: release --clean --skip=chocolatey
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
- name: Check what GoReleaser created
run: |
Write-Host "📁 Checking dist directory contents..."
if (Test-Path 'dist') {
Write-Host "✅ dist folder exists!"
Get-ChildItem -Path 'dist' -Recurse | Select-Object FullName, Length
} else {
Write-Host "❌ dist folder not found!"
}
Write-Host ""
Write-Host "🔍 Looking for scoop manifest..."
if (Test-Path 'dist/scoop/zed-cli-win-unofficial.json') {
Write-Host "✅ Scoop manifest found!"
Write-Host "📦 Original manifest contents:"
Get-Content 'dist/scoop/zed-cli-win-unofficial.json' | Write-Host
} else {
Write-Host "❌ Scoop manifest not found in expected location"
Write-Host "📁 Checking what's in dist/scoop/:"
if (Test-Path 'dist/scoop') {
Get-ChildItem 'dist/scoop' | Write-Host
} else {
Write-Host "❌ dist/scoop directory doesn't exist"
}
}
shell: powershell
- name: Fix Scoop Manifest (Test - Log Only)
run: |
Write-Host "🔧 Testing scoop manifest fix..."
if (Test-Path 'dist/scoop/zed-cli-win-unofficial.json') {
Write-Host "✅ Found scoop manifest, reading contents..."
# Read the original content as text to preserve formatting
$content = Get-Content 'dist/scoop/zed-cli-win-unofficial.json' -Raw
Write-Host "📄 Original manifest:"
Write-Host $content
# Parse JSON to check current bin array (for logging only)
$manifest = $content | ConvertFrom-Json
Write-Host ""
Write-Host "📋 Current bin array:"
$manifest.architecture."64bit".bin | ForEach-Object { Write-Host " - $_" }
# Use regex to find and modify the bin array while preserving formatting
# This looks for the bin array pattern and adds zed.bat if not already present
if ($content -notmatch '"zed-cli-win-unofficial/zed\.bat"') {
Write-Host ""
Write-Host "🔧 Adding zed.bat to bin array..."
# Find the bin array and add the new entry
# Pattern matches: "bin": ["existing-entry"] or "bin": ["entry1", "entry2"]
$pattern = '("bin":\s*\[\s*"[^"]+")(\s*\])'
$replacement = '$1, "zed-cli-win-unofficial/zed.bat"$2'
$updatedContent = $content -replace $pattern, $replacement
Write-Host "📄 Updated manifest:"
Write-Host $updatedContent
# Create bucket directory for testing
if (-not (Test-Path 'bucket')) {
New-Item -ItemType Directory -Path 'bucket'
Write-Host ""
Write-Host "📁 Created bucket directory (for testing)"
}
# Save the updated manifest with preserved formatting
$updatedContent | Set-Content 'bucket/zed-cli-win-unofficial.json' -NoNewline
Write-Host ""
Write-Host "💾 Saved updated manifest to bucket/ (for testing)"
Write-Host "✅ Scoop manifest fix test successful!"
}
else {
Write-Host ""
Write-Host "✅ zed.bat already exists in bin array"
}
}
else {
Write-Host "❌ Scoop manifest not found"
exit 1
}
shell: powershell
- name: Show what would be committed
run: |
Write-Host "📊 Summary of what would be committed to repository:"
Write-Host ""
if (Test-Path 'bucket/zed-cli-win-unofficial.json') {
Write-Host "✅ bucket/zed-cli-win-unofficial.json"
Write-Host " Size: $((Get-Item 'bucket/zed-cli-win-unofficial.json').Length) bytes"
Write-Host ""
Write-Host "📄 File contents that would be committed:"
Get-Content 'bucket/zed-cli-win-unofficial.json' | Write-Host
} else {
Write-Host "❌ No manifest file to commit"
}
Write-Host ""
Write-Host "🚀 In a real release, this would:"
Write-Host " 1. Create/update bucket/zed-cli-win-unofficial.json"
Write-Host " 2. Commit with message: 'Scoop update for zed-cli-win-unofficial version ${{ github.ref_name }}'"
Write-Host " 3. Push to main branch"
Write-Host ""
Write-Host "ℹ️ To enable actual committing, update the workflow to include git commands"
shell: powershell