Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -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) }

Expand Down
23 changes: 17 additions & 6 deletions scripts/appcast.sh
Original file line number Diff line number Diff line change
@@ -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 <item> 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/&/\&amp;/g; s/</\&lt;/g; s/>/\&gt;/g; s/"/\&quot;/g; s/'"'"'/\&#39;/g')

# Add description after the first <title> tag within an <item>
xml=$(echo "$xml" | sed '0,/<item>/,/<\/title>/{s|</title>|</title>\n <description><![CDATA['"$escaped_notes"']]></description>|;}')
fi

echo "$xml" > releases/appcast.xml

echo "XML file generated successfully."
echo "🟩 Created AppCast XML correctly"