Compare commits

...
5 Commits
Author SHA1 Message Date
Tobias Gesellchen 7117ff6592 Fix GitHub Actions permissions for release workflow
- Add contents:write permission to allow updating releases
- Add actions:read permission for artifact downloads
- Resolves 'Resource not accessible by integration' error
2026-01-10 01:19:40 +01:00
Tobias Gesellchen d7b1c94b9a Fix directory flattening in release workflow
- Use dedicated collection directory to avoid naming conflicts
- Simplify file movement logic by using release-files directory
- Update artifact upload paths to match new structure
- Resolves mv errors when files have same names as directories
2026-01-10 01:15:45 +01:00
Tobias Gesellchen 3cc45ebd20 debug: add comprehensive directory listings to diagnose build conflicts
Add ls -la output for:
- Working directory before/after build
- Go build cache location and contents
- Go module cache contents
- Post-build state verification

Simple directory listings often reveal file permission issues,
cached artifacts, or leftover files that cause 'File exists' errors
better than complex debugging output.
2026-01-10 01:08:13 +01:00
Tobias Gesellchen a30251854c fix: add debugging and improve build robustness for file conflicts
- Clean build environment before building (remove existing files, clean cache)
- Add atomic checksum generation using temp directory
- Improve error handling with explicit build failure detection
- Add debugging output to diagnose 'File exists' errors
- Use basename in temp operations to avoid path issues

This should resolve the 'Cannot open: File exists' errors occurring
during the darwin/arm64 build process.
2026-01-10 01:07:41 +01:00
Tobias Gesellchen 1a1d37b885 fix: resolve directory overwrite error in checksums generation
Use find -mindepth 2 to only move files from subdirectories, avoiding
the 'mv: cannot overwrite directory' error when flattening the artifact
directory structure. This ensures only the actual binary and checksum
files are moved, not the directories themselves.

Fixes the sha256sum failure in the Generate Checksums workflow step.
2026-01-10 01:04:49 +01:00
+64 -15
View File
@@ -10,6 +10,10 @@ on:
required: true
default: "v1.0.0"
permissions:
contents: write
actions: read
env:
GO_VERSION_FILE: "go.mod"
@@ -132,11 +136,38 @@ jobs:
echo "Building: $OUTPUT_NAME"
# Debug: Show current state
echo "Working directory: $(pwd)"
echo "Go version: $(go version)"
echo "Files before build:"
ls -la
# Debug: Show Go cache and module cache
echo "Go build cache location: $(go env GOCACHE)"
echo "Go module cache location: $(go env GOMODCACHE)"
echo "Go build cache contents:"
ls -la "$(go env GOCACHE)" 2>/dev/null || echo "Cache directory not accessible"
echo "Go module cache contents (top level):"
ls -la "$(go env GOMODCACHE)" 2>/dev/null || echo "Module cache directory not accessible"
# Ensure clean build environment
rm -f "$OUTPUT_NAME" "$OUTPUT_NAME.sha256" "$OUTPUT_NAME.sha512"
go clean -cache
# Build with optimizations and version info
go build \
if ! go build \
-ldflags="-s -w -X main.version=v${{ needs.validate.outputs.version }} -X main.commit=${{ github.sha }} -X main.date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o "$OUTPUT_NAME" \
./cmd/soundtouch-cli
./cmd/soundtouch-cli; then
echo "❌ Build failed"
echo "Files after failed build:"
ls -la
exit 1
fi
# Debug: Show post-build state
echo "Files after successful build:"
ls -la
# Verify binary was created and is executable
ls -la "$OUTPUT_NAME"
@@ -148,12 +179,25 @@ jobs:
- name: Generate individual checksum
run: |
OUTPUT_NAME="${{ steps.build.outputs.binary_name }}"
sha256sum "$OUTPUT_NAME" > "$OUTPUT_NAME.sha256"
sha512sum "$OUTPUT_NAME" > "$OUTPUT_NAME.sha512"
echo "📋 Generated individual checksums:"
cat "$OUTPUT_NAME.sha256"
cat "$OUTPUT_NAME.sha512"
# Use atomic operations to avoid conflicts
TEMP_DIR=$(mktemp -d)
echo "Building checksums for: $OUTPUT_NAME"
echo "Matrix: ${{ matrix.goos }}-${{ matrix.goarch }}"
# Generate checksums in temp directory first
sha256sum "$OUTPUT_NAME" > "${TEMP_DIR}/$(basename "$OUTPUT_NAME").sha256"
sha512sum "$OUTPUT_NAME" > "${TEMP_DIR}/$(basename "$OUTPUT_NAME").sha512"
# Move to final location atomically
mv "${TEMP_DIR}/$(basename "$OUTPUT_NAME").sha256" "$OUTPUT_NAME.sha256"
mv "${TEMP_DIR}/$(basename "$OUTPUT_NAME").sha512" "$OUTPUT_NAME.sha512"
# Cleanup
rm -rf "$TEMP_DIR"
echo "✅ Checksums generated successfully"
- name: Upload build artifact
uses: actions/upload-artifact@v6
@@ -184,13 +228,18 @@ jobs:
echo "📁 Downloaded artifact structure:"
find . -type f -name "soundtouch-cli-*"
# Flatten directory structure (artifacts are in subdirs)
# Move all binary files to current directory
find . -type f -name "soundtouch-cli-*" -exec mv {} . \;
# Create a collection directory to avoid naming conflicts
mkdir -p release-files
# Move all files from subdirectories to the collection directory
find . -mindepth 2 -type f -name "soundtouch-cli-*" -exec mv {} release-files/ \;
# Remove empty directories
find . -type d -empty -delete
# Move to the collection directory for the rest of the processing
cd release-files
# Debug: Show flattened structure
echo "📁 Flattened structure:"
ls -la soundtouch-cli-* || echo "No files found matching pattern"
@@ -227,17 +276,17 @@ jobs:
with:
name: checksums
path: |
binaries/checksums.sha256
binaries/checksums.sha512
binaries/*.sha256
binaries/*.sha512
binaries/release-files/checksums.sha256
binaries/release-files/checksums.sha512
binaries/release-files/*.sha256
binaries/release-files/*.sha512
retention-days: 1
- name: Upload all release assets
uses: actions/upload-artifact@v6
with:
name: release-assets
path: binaries/
path: binaries/release-files/
retention-days: 1
create_release: