BUILD_RELEASE:

- fixed commits until last release (not tag)
- adding debug for manifest body
This commit is contained in:
XargonWan 2024-11-13 14:07:43 +09:00
parent 0bdd0096e0
commit b4e4cdd607

View file

@ -108,61 +108,83 @@ jobs:
- name: "[DEBUG] Outputting manifest"
run: cat net.retrodeck.retrodeck.yml
# Get Commits Since Last Release
- name: Get commits since last release
# Get Commits Since Last Published Release (Cooker only)
- name: Get commits since last published release
id: get-commits
if: github.ref != 'refs/heads/main'
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 $(git rev-list --tags --max-count=1 --first-parent) || echo "")
# Get the latest published release tag
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "")
if [ -z "$LATEST_TAG" ]; then
echo "[INFO] No previous release found. Using all commits."
COMMITS=$(git log HEAD --pretty=format:"- %s")
else
echo "[INFO] Latest published release tag: $LATEST_TAG"
COMMITS=$(git log ${LATEST_TAG}..HEAD --pretty=format:"- %s")
fi
# Debug: Print the commits list
echo "Commits since $LATEST_TAG:"
echo "$COMMITS"
# Export the commits list to the GitHub environment
echo "COMMITS=$COMMITS" >> $GITHUB_ENV
# Generate Release Body
- name: Generate release body text
id: generate-body
run: |
# Initialize the release body text
RELEASE_BODY="# Release Notes\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+="This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}."
RELEASE_BODY+="On branch [${{env.BRANCH_NAME}}](https://repo.retrodeck.net/RetroDECK/RetroDECK/src/branch/${{env.BRANCH_NAME}})."
RELEASE_BODY+="## Commits since last release\n"
RELEASE_BODY+="$COMMITS\n\n"
echo "[DEBUG] CHECKPOINT 1"
xml_file="./net.retrodeck.retrodeck.appdata.xml"
if [[ ! -f "$xml_file" ]]; then
echo "Error: XML file not found: $xml_file"
exit 1
fi
echo "[DEBUG] CHECKPOINT 2"
# Extract the raw description content using xmlstarlet
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
echo "[DEBUG] CHECKPOINT 3"
# Convert <p> tags to markdown headers using sed
markdown_description=$(echo "$raw_description" | sed -e 's|<p>|\n### |g' -e 's|</p>||g')
echo "[DEBUG] CHECKPOINT 4"
# Convert <li> tags to bullet points and trim spaces
markdown_description=$(echo "$markdown_description" | sed -e 's|<ul>||g' -e 's|</ul>||g' -e 's|<li>|- |g' -e 's|</li>||g' | awk '{$1=$1;print}')
echo "[DEBUG] CHECKPOINT 5"
# Remove any remaining XML tags
markdown_description=$(echo "$markdown_description" | sed -e 's/<[^>]*>//g')
echo "[DEBUG] CHECKPOINT 6"
# Debug: Print the markdown description
echo "Markdown Description:"
echo "$markdown_description"
echo "[DEBUG] CHECKPOINT 7"
# Append markdown content to the release body
RELEASE_BODY+="$markdown_description"
printf "RELEASE_BODY=%s\n" "$RELEASE_BODY" >> $GITHUB_ENV
echo "[DEBUG] CHECKPOINT 8"
- name: "Build flatpak: download only"
run: "/bin/bash ${GITHUB_WORKSPACE}/automation_tools/flatpak_build_download_only.sh"