diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d6f99f0a..6271db79 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -38,19 +38,20 @@ platform :mac do set_github_release( repository_name: "ospfranco/sol", api_token: ENV["GITHUB_API_TOKEN"], - name: "v" + version, tag_name: version, - description: "No release notes provided.", + is_generate_release_notes: true, upload_assets: [zipFileName] ) + release_notes = lane_context[SharedValues::SET_GITHUB_RELEASE_JSON]["body"] + file_url = "https://github.com/ospfranco/sol/releases/download/" + version + "/" + version + ".zip" Dir.chdir("..") do sh("bun", "appcast") - sh("./scripts/appcast.sh", file_url, version) + sh("./scripts/appcast.sh", file_url, version, release_notes) Dir.glob("#{path}releases/*.zip").each { |file| File.delete(file) } diff --git a/scripts/appcast.sh b/scripts/appcast.sh index 777c0bd8..2c8e5545 100755 --- a/scripts/appcast.sh +++ b/scripts/appcast.sh @@ -1,18 +1,29 @@ -#!/bin/bash +#!/bin/sh url="$1" version="$2" +release_notes="$3 + +echo "🟠 Creating release version $version" +echo "Release Notes" +echo "$release_notes" url_to_replace="https://raw.githubusercontent.com/ospfranco/sol/main/releases/$version.zip" -# XML template -# Read XML content from file xml=$(cat releases/appcast.xml) -# Replace the url xml=${xml//"$url_to_replace"/"$url"} -# Save XML content to a file +# Add release notes to the first item (most recent version) +# Find the first and add description after the title +if [ -n "$release_notes" ]; then + # Escape special characters in release notes for XML + escaped_notes=$(echo "$release_notes" | sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g') + + # Add description after the first tag within an <item> + xml=$(echo "$xml" | sed '0,/<item>/,/<\/title>/{s||\n |;}') +fi + echo "$xml" > releases/appcast.xml -echo "XML file generated successfully." \ No newline at end of file +echo "🟩 Created AppCast XML correctly" \ No newline at end of file