diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 6724f46b..c99c59ad 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -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
tags to markdown headers using sed markdown_description=$(echo "$raw_description" | sed -e 's|
|\n### |g' -e 's|
||g') + echo "[DEBUG] CHECKPOINT 4" + # Convert