Skip to content

Commit 334a0c7

Browse files
committed
chore: enhance build environment setup in main release workflow
1 parent c970a41 commit 334a0c7

File tree

1 file changed

+77
-27
lines changed

1 file changed

+77
-27
lines changed

.github/workflows/main-release.yml

Lines changed: 77 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,22 @@ jobs:
426426
if: matrix.platform == 'ubuntu-22.04'
427427
run: |
428428
sudo apt-get update
429-
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf curl wget unzip
429+
sudo apt-get install -y \
430+
libwebkit2gtk-4.1-dev \
431+
libappindicator3-dev \
432+
librsvg2-dev \
433+
patchelf \
434+
curl \
435+
wget \
436+
unzip \
437+
libfuse2 \
438+
file \
439+
libglib2.0-dev
440+
441+
# Configure AppImage environment for CI
442+
# AppImages need FUSE but GitHub Actions doesn't have it by default
443+
# We'll extract the AppImage instead of running it with FUSE
444+
echo "APPIMAGE_EXTRACT_AND_RUN=1" >> $GITHUB_ENV
430445
431446
- name: Install create-dmg (macOS)
432447
if: matrix.platform == 'macos-latest'
@@ -515,6 +530,29 @@ jobs:
515530
shell: bash
516531
run: bash src-tauri/scripts/setup-build-jre.sh
517532

533+
- name: Verify AppImage build environment (Ubuntu)
534+
if: matrix.platform == 'ubuntu-22.04'
535+
shell: bash
536+
run: |
537+
echo "🔍 Verifying AppImage build environment..."
538+
539+
# Check system dependencies
540+
echo "Checking libfuse2..."
541+
ldconfig -p | grep libfuse.so || echo "⚠️ libfuse2 may not be properly installed"
542+
543+
# Check environment variables
544+
echo "APPIMAGE_EXTRACT_AND_RUN: ${APPIMAGE_EXTRACT_AND_RUN:-not set}"
545+
546+
# Verify JRE is set up
547+
if [ -d "src-tauri/resources/build-jre" ]; then
548+
echo "✅ JRE directory exists"
549+
echo "JRE size: $(du -sh src-tauri/resources/build-jre | cut -f1)"
550+
else
551+
echo "⚠️ JRE directory not found"
552+
fi
553+
554+
echo "✅ AppImage environment verification complete"
555+
518556
- name: Extract changelog for release
519557
id: changelog
520558
shell: bash
@@ -602,6 +640,8 @@ jobs:
602640
FORMATTED_CHANGELOG="$CHANGELOG_CONTENT"
603641
fi
604642
643+
FORMATTED_CHANGELOG=$(echo "$FORMATTED_CHANGELOG" | tr -d '\r\t' | sed 's/\\/\\\\/g')
644+
605645
echo "changelog<<EOF" >> $GITHUB_OUTPUT
606646
echo "$FORMATTED_CHANGELOG" >> $GITHUB_OUTPUT
607647
echo "EOF" >> $GITHUB_OUTPUT
@@ -652,6 +692,9 @@ jobs:
652692
APPLE_ID: ${{ secrets.APPLE_ID }}
653693
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
654694
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
695+
APPIMAGE_EXTRACT_AND_RUN: "1"
696+
NO_STRIP: "true"
697+
VERBOSE: "1"
655698
with:
656699
tagName: ${{ needs.prepare-release.outputs.tag }}
657700
releaseName: "mpesa2csv ${{ needs.prepare-release.outputs.tag }}"
@@ -715,36 +758,43 @@ jobs:
715758
if command -v gh &> /dev/null; then
716759
GITHUB_NOTES=$(gh api repos/${{ github.repository }}/releases/latest --jq '.body' 2>/dev/null || echo "")
717760
if [ -n "$GITHUB_NOTES" ] && [ "$GITHUB_NOTES" != "null" ]; then
718-
# Truncate if too long and clean up markdown
719-
RELEASE_NOTES=$(echo "$GITHUB_NOTES" | head -20 | sed 's/^## /## /g' | sed 's/^### /### /g')
761+
# Truncate if too long and clean up markdown, sanitize control characters
762+
RELEASE_NOTES=$(echo "$GITHUB_NOTES" | head -20 | sed 's/^## /## /g' | sed 's/^### /### /g' | tr -d '\r\t')
720763
fi
721764
fi
722765
723-
cat > latest.json << EOF
724-
{
725-
"version": "$VERSION",
726-
"notes": "$RELEASE_NOTES",
727-
"pub_date": "$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")",
728-
"platforms": {
729-
"darwin-aarch64": {
730-
"signature": "",
731-
"url": "https://github.com/${{ github.repository }}/releases/download/$TAG/mpesa2csv_aarch64.app.tar.gz"
732-
},
733-
"darwin-x86_64": {
734-
"signature": "",
735-
"url": "https://github.com/${{ github.repository }}/releases/download/$TAG/mpesa2csv_x64.app.tar.gz"
736-
},
737-
"linux-x86_64": {
738-
"signature": "",
739-
"url": "https://github.com/${{ github.repository }}/releases/download/$TAG/mpesa2csv_${VERSION}_amd64.AppImage"
740-
},
741-
"windows-x86_64": {
742-
"signature": "",
743-
"url": "https://github.com/${{ github.repository }}/releases/download/$TAG/mpesa2csv_${VERSION}_x64-setup.exe"
766+
# Use jq to properly create JSON with escaped strings
767+
jq -n \
768+
--arg version "$VERSION" \
769+
--arg notes "$RELEASE_NOTES" \
770+
--arg pub_date "$(date -u +"%Y-%m-%dT%H:%M:%S.000Z")" \
771+
--arg darwin_aarch64_url "https://github.com/${{ github.repository }}/releases/download/$TAG/mpesa2csv_aarch64.app.tar.gz" \
772+
--arg darwin_x86_64_url "https://github.com/${{ github.repository }}/releases/download/$TAG/mpesa2csv_x64.app.tar.gz" \
773+
--arg linux_x86_64_url "https://github.com/${{ github.repository }}/releases/download/$TAG/mpesa2csv_${VERSION}_amd64.AppImage" \
774+
--arg windows_x86_64_url "https://github.com/${{ github.repository }}/releases/download/$TAG/mpesa2csv_${VERSION}_x64-setup.exe" \
775+
'{
776+
version: $version,
777+
notes: $notes,
778+
pub_date: $pub_date,
779+
platforms: {
780+
"darwin-aarch64": {
781+
signature: "",
782+
url: $darwin_aarch64_url
783+
},
784+
"darwin-x86_64": {
785+
signature: "",
786+
url: $darwin_x86_64_url
787+
},
788+
"linux-x86_64": {
789+
signature: "",
790+
url: $linux_x86_64_url
791+
},
792+
"windows-x86_64": {
793+
signature: "",
794+
url: $windows_x86_64_url
795+
}
744796
}
745-
}
746-
}
747-
EOF
797+
}' > latest.json
748798
749799
echo "📄 Generated latest.json:"
750800
cat latest.json

0 commit comments

Comments
 (0)