Skip to content

Commit

Permalink
Add a Changelog button
Browse files Browse the repository at this point in the history
  • Loading branch information
InfusOnWoW committed Jan 4, 2025
1 parent 5c3407e commit 8d23e04
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 0 deletions.
6 changes: 6 additions & 0 deletions WeakAurasOptions/Changelog.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if not WeakAuras.IsLibsOK() then return end
---@type string
local AddonName = ...
---@class OptionsPrivate
local OptionsPrivate = select(2, ...)

15 changes: 15 additions & 0 deletions WeakAurasOptions/OptionsFrames/OptionsFrame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,21 @@ function OptionsPrivate.CreateFrame()
thanksButton:SetParent(tipFrame)
thanksButton:SetPoint("LEFT", documentationButton, "RIGHT", 10, 0)

if OptionsPrivate.changelog then
local changelog
if OptionsPrivate.changelog.highlightText then
changelog = L["Highlights"] .. "\n" .. OptionsPrivate.changelog.highlightText .. "\n"
.. L["Commits"] .. "\n" ..OptionsPrivate.changelog.commitText
else
changelog = OptionsPrivate.changelog.commitText
end

local changelogButton = addFooter(L["Changelog"], "", OptionsPrivate.changelog.fullChangeLogUrl,
changelog, nil, nil, false, 800)
changelogButton:SetParent(tipFrame)
changelogButton:SetPoint("LEFT", thanksButton, "RIGHT", 10, 0)
end

local reportbugButton = addFooter(L["Found a Bug?"], [[Interface\AddOns\WeakAuras\Media\Textures\bug_report.tga]], "https://github.com/WeakAuras/WeakAuras2/issues/new?assignees=&labels=%F0%9F%90%9B+Bug&template=bug_report.md&title=",
L["Report bugs on our issue tracker."], nil, nil, true)
reportbugButton:SetParent(tipFrame)
Expand Down
2 changes: 2 additions & 0 deletions WeakAurasOptions/WeakAurasOptions.toc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ WeakAurasOptions.lua
ConditionOptions.lua
AuthorOptions.lua

Changelog.lua

OptionsFrames\OptionsFrame.lua

# Groups
Expand Down
2 changes: 2 additions & 0 deletions WeakAurasOptions/WeakAurasOptions_Cata.toc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ WeakAurasOptions.lua
ConditionOptions.lua
AuthorOptions.lua

Changelog.lua

OptionsFrames\OptionsFrame.lua

# Groups
Expand Down
2 changes: 2 additions & 0 deletions WeakAurasOptions/WeakAurasOptions_Vanilla.toc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ WeakAurasOptions.lua
ConditionOptions.lua
AuthorOptions.lua

Changelog.lua

OptionsFrames\OptionsFrame.lua

# Groups
Expand Down
16 changes: 16 additions & 0 deletions generate_changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ fi
date=$( git log -1 --date=short --format="%ad" )
url=$( git remote get-url origin | sed -e 's/^git@\(.*\):/https:\/\/\1\//' -e 's/\.git$//' )

# Changlog.md
echo -ne "# [${version}](${url}/tree/${current}) ($date)\n\n[Full Changelog](${url}/compare/${previous}...${current})\n\n" > "CHANGELOG.md"

if [ "$version" = "$tag" ]; then # on a tag
Expand All @@ -31,3 +32,18 @@ if [ "$version" = "$tag" ]; then # on a tag
fi

git shortlog --no-merges --reverse "$previous..$current" | sed -e '/^\w/G' -e 's/^ /- /' >> "CHANGELOG.md"

# Changelog.lua
echo -ne "if not WeakAuras.IsLibsOK() then return end\n---@type string\nlocal AddonName = ...\n---@class OptionsPrivate\nlocal OptionsPrivate = select(2, ...)\n" >> "WeakAurasOptions/Changelog.lua"
echo -ne "OptionsPrivate.changelog = {\n" >> "WeakAurasOptions/Changelog.lua"
echo -ne " versionString = '$version',\n" >> "WeakAurasOptions/Changelog.lua"
echo -ne " dateString = '$date',\n" >> "WeakAurasOptions/Changelog.lua"
echo -ne " fullChangeLogUrl = '${url}/compare/${previous}...${current}',\n" >> "WeakAurasOptions/Changelog.lua"
if [ "$version" = "$tag" ]; then # on a tag
echo -ne " highlightText = [==[\n" >> "WeakAurasOptions/Changelog.lua"
echo -ne "$highlights" >> "WeakAurasOptions/Changelog.lua"
echo -ne "]==]," >> "WeakAurasOptions/Changelog.lua"
fi
echo -ne " commitText = [==[" >> "WeakAurasOptions/Changelog.lua"
git shortlog --no-merges --reverse "$previous..$current" | sed -e '/^\w/G' -e 's/^ /- /' >> "WeakAurasOptions/Changelog.lua"
echo -ne "]==]\n}" >> "WeakAurasOptions/Changelog.lua"

0 comments on commit 8d23e04

Please sign in to comment.