Skip to content

Commit 63b53b1

Browse files
committed
ci: Build test
1 parent 0352b94 commit 63b53b1

File tree

1 file changed

+82
-14
lines changed

1 file changed

+82
-14
lines changed

.github/workflows/packages.yml

Lines changed: 82 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -763,21 +763,82 @@ jobs:
763763
echo "Created test assets file:"
764764
cat test_assets.md
765765
766+
- name: Create Real Asset Categories
767+
id: create_real_categories
768+
run: |
769+
# Process actual release assets
770+
# Create function to generate category sections
771+
generate_category() {
772+
local category=$1
773+
local pattern=$2
774+
local title=$3
775+
776+
echo "### $title"
777+
echo ""
778+
779+
# Filter assets matching the pattern and exclude checksums
780+
matching_assets=$(grep -i "$pattern" assets.txt | grep -v "\.sha256$" | sort)
781+
if [ -z "$matching_assets" ]; then
782+
echo "No $category packages available."
783+
else
784+
echo "| Package | SHA256 |"
785+
echo "|---------|--------|"
786+
while read -r line; do
787+
if [ -n "$line" ]; then
788+
name=$(echo "$line" | awk '{print $1}')
789+
url=$(echo "$line" | awk '{print $2}')
790+
# Look for corresponding SHA256 file
791+
sha_line=$(grep "${name}\.sha256" assets.txt || echo "")
792+
if [ -n "$sha_line" ]; then
793+
sha_url=$(echo "$sha_line" | awk '{print $2}')
794+
echo "| [$name]($url) | [SHA256]($sha_url) |"
795+
else
796+
echo "| [$name]($url) | N/A |"
797+
fi
798+
fi
799+
done <<< "$matching_assets"
800+
fi
801+
echo ""
802+
}
803+
804+
# Generate real assets markdown
805+
{
806+
echo "## Binary Downloads"
807+
echo ""
808+
generate_category "Linux" "linux" "Linux Binaries"
809+
generate_category "Windows" "windows" "Windows Binaries"
810+
generate_category "macOS" "macos" "macOS Binaries"
811+
generate_category "FreeBSD" "freebsd" "FreeBSD Binaries"
812+
generate_category "NetBSD" "netbsd" "NetBSD Binaries"
813+
814+
echo "## Package Downloads"
815+
echo ""
816+
generate_category "Debian" "_amd64\.deb\|_arm64\.deb\|_i386\.deb" "Debian/Ubuntu Packages (.deb)"
817+
generate_category "RPM" "\.rpm" "Red Hat/Fedora/SUSE Packages (.rpm)"
818+
generate_category "AUR" "aur" "Arch Linux Package (AUR)"
819+
generate_category "Homebrew" "homebrew" "macOS Homebrew Formula"
820+
generate_category "DMG" "\.dmg" "macOS Disk Image (.dmg)"
821+
generate_category "Nix" "nix" "Nix Packages"
822+
} > real_assets.md
823+
824+
echo "Created real assets content (first 20 lines):"
825+
head -20 real_assets.md
826+
766827
- name: Combine Content (Debug Step 5)
767828
id: combine_content
768829
run: |
769830
# Create a simplified combined body
770831
if [ -n "$EXISTING_BODY" ]; then
771-
echo "Using existing body and appending test content"
832+
echo "Using existing body and appending real content"
772833
echo "$EXISTING_BODY" > combined_body.md
773-
cat test_assets.md >> combined_body.md
834+
cat real_assets.md >> combined_body.md
774835
else
775-
echo "Creating a new body with version and test content"
836+
echo "Creating a new body with version and real content"
776837
echo "## ApiSnip v${VERSION}" > combined_body.md
777838
echo "" >> combined_body.md
778839
echo "A terminal user interface (TUI) tool for trimming OpenAPI specifications down to size ✂️" >> combined_body.md
779840
echo "" >> combined_body.md
780-
cat test_assets.md >> combined_body.md
841+
cat real_assets.md >> combined_body.md
781842
fi
782843
783844
echo "First 20 lines of combined body:"
@@ -795,10 +856,9 @@ jobs:
795856
- name: Update Release Description (Debug Step 6)
796857
run: |
797858
RELEASE_ID="${{ steps.get_release_id.outputs.RELEASE_ID }}"
798-
ESCAPED_CONTENT=$(cat escaped_content.json)
799859
800-
echo "Using simplified JSON payload for testing"
801-
echo "{\"body\": \"Test update from GitHub Actions\"}" > test_payload.json
860+
echo "Using minimal test update to verify API access"
861+
echo "{\"body\": \"Test update from GitHub Actions - preparing real content...\"}" > test_payload.json
802862
803863
echo "Sending test update to release ID: $RELEASE_ID"
804864
HTTP_STATUS=$(curl -s -o update_response.txt -w "%{http_code}" \
@@ -820,23 +880,31 @@ jobs:
820880
exit 1
821881
fi
822882
823-
- name: Final Update (Debug Step 7)
824-
if: false # Skip this step for now while debugging
883+
- name: Final Update With Assets
884+
id: final_update
825885
run: |
826886
RELEASE_ID="${{ steps.get_release_id.outputs.RELEASE_ID }}"
827887
ESCAPED_CONTENT=$(cat escaped_content.json)
828888
829-
echo "Sending final update to release ID: $RELEASE_ID"
830-
curl -s -o final_response.txt \
889+
echo "Sending final update with full asset tables to release ID: $RELEASE_ID"
890+
HTTP_STATUS=$(curl -s -o final_response.txt -w "%{http_code}" \
831891
-X PATCH \
832892
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
833893
-H "Accept: application/vnd.github+json" \
834894
-H "Content-Type: application/json" \
835895
"https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID" \
836-
-d "{\"body\": ${ESCAPED_CONTENT}}"
896+
-d "{\"body\": ${ESCAPED_CONTENT}}")
837897
838-
echo "Response:"
839-
cat final_response.txt
898+
echo "Final update HTTP Status: $HTTP_STATUS"
899+
900+
if [ "$HTTP_STATUS" = "200" ]; then
901+
echo "✅ Release description successfully updated with all assets"
902+
else
903+
echo "❌ Final update failed"
904+
echo "Response (first 500 chars):"
905+
cat final_response.txt | head -c 500
906+
exit 1
907+
fi
840908
841909
# Add new Nix Package job
842910
create-nix-package:

0 commit comments

Comments
 (0)