From 487cdb509bdb9a68842cb65fd42efa4bb3d9b5eb Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 12 Nov 2024 15:09:54 +0900 Subject: [PATCH] Workflow: debugging generate-body step --- .github/workflows/build_release.yml | 43 +++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 2600460d..b1e931a7 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -160,32 +160,57 @@ jobs: - name: Generate release body text id: generate-body run: | + # Enable debugging + set -x + + # Initialize the release body RELEASE_BODY="# Release Notes\n" - RELEASE_BODY+="This release is based on the commit: ${{ github.repository }}@${{ github.sha }}.\n" - RELEASE_BODY+="On branch [${{ env.BRANCH_NAME }}](https://github.com/RetroDECK/RetroDECK/tree/${{ env.BRANCH_NAME }}).\n\n" + RELEASE_BODY+="This release is based on the commit: RetroDECK/RetroDECK@c8bd579ad4d0922ba7ab1f5c122cc782ff6adc66.\n" + RELEASE_BODY+="On branch [cooker](https://github.com/RetroDECK/RetroDECK/tree/cooker).\n\n" RELEASE_BODY+="## Commits since last release\n" - RELEASE_BODY+="${{ steps.get-commits.outputs.commits }}\n\n" + RELEASE_BODY+="- RELEASE NOTES: fixed body\n\n" # Define the XML file path xml_file="./net.retrodeck.retrodeck.appdata.xml" - # Extract the raw description content - raw_description=$(xmlstarlet sel -t -m "/component/releases/release[1]/description/*" -c "." -n "$xml_file") + # Check if the XML file exists + if [[ ! -f "$xml_file" ]]; then + echo "Error: XML file not found: $xml_file" + exit 1 + fi - # Convert

tags to markdown headers using sed and place headers correctly + # Extract the raw description content + raw_description=$(xmlstarlet sel -t -m "/component/releases/release[1]/description/*" -c "." -n "$xml_file" 2>/dev/null) + + # Check if xmlstarlet extraction was successful + if [[ $? -ne 0 ]]; then + echo "Error: Failed to extract description content using xmlstarlet" + exit 1 + fi + + # Convert

tags to markdown headers using sed markdown_description=$(echo "$raw_description" | sed -e 's|

|\n### |g' -e 's|

||g') - # Convert
  • tags to bullet points and remove leading spaces + # Convert
  • tags to bullet points and trim spaces markdown_description=$(echo "$markdown_description" | sed -e 's|||g' -e 's|
  • |- |g' -e 's|
  • ||g' | awk '{$1=$1;print}') # Remove any remaining XML tags markdown_description=$(echo "$markdown_description" | sed -e 's/<[^>]*>//g') + # Debug: Print the markdown description + echo "Markdown Description:" + echo "$markdown_description" + # Append markdown content with proper formatting RELEASE_BODY+="$markdown_description\n" - # Use printf to preserve newlines and output to GITHUB_OUTPUT - printf "release_body<> $GITHUB_OUTPUT + # Output the release body for GitHub Actions + { + printf "release_body<> "$GITHUB_OUTPUT" + + # Disable debugging + set +x - name: "Build flatpak: download only" run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"