diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..2f93975 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,75 @@ +name: release + +on: + push: + tags: + - '*-coa.*' # Asc-1.1.6-coa.2, 9.1.40-coa.3, etc. + - 'v*' # v0.3.0 for repos without an upstream version + +jobs: + release: + runs-on: linux-amd64 + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 # build_zip uses git archive HEAD; full history is fine + + - name: Build per-addon zip(s) + run: bash tools/build_zip.sh + + - name: Publish release (Gitea API direct; no action dependency) + env: + GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + TAG: ${{ github.ref_name }} + API: ${{ github.server_url }}/api/v1 + # Gitea attachment ceiling is 200 MiB (see roles/gitea config). + # Skip anything larger so one oversized asset doesn't fail the job. + MAX_BYTES: 209715200 + run: | + set -euo pipefail + # Create the release (or reuse if it already exists for this tag). + RID=$(curl -s -H "Authorization: token $GITEA_TOKEN" \ + "$API/repos/$REPO/releases/tags/$TAG" 2>/dev/null \ + | jq -r '.id // empty') + if [ -z "$RID" ]; then + RID=$(curl -sf -X POST -H "Authorization: token $GITEA_TOKEN" \ + -H "Content-Type: application/json" \ + "$API/repos/$REPO/releases" \ + -d "$(jq -nc --arg t "$TAG" '{tag_name:$t,name:$t,draft:false,prerelease:false,hide_archive_links:true}')" \ + | jq -r '.id') + fi + echo "release id: $RID" + # Gitea honors hide_archive_links only on edit, not create — PATCH it + # so the auto-generated Source Code (zip/tar.gz) links stay hidden. + curl -sf -X PATCH -H "Authorization: token $GITEA_TOKEN" -H "Content-Type: application/json" \ + "$API/repos/$REPO/releases/$RID" -d '{"hide_archive_links":true}' >/dev/null || true + # Upload every dist/*.zip. Per-asset failures don't fail the job — + # we want partial releases to still publish rather than block the + # whole pipeline on one big file. + failed=0 + uploaded=0 + for f in dist/*.zip; do + name=$(basename "$f") + size=$(stat -c '%s' "$f") + if [ "$size" -gt "$MAX_BYTES" ]; then + echo "::warning::skip $name (${size} B > ${MAX_BYTES} B Gitea limit; host on CDN instead)" + failed=$((failed+1)) + continue + fi + echo "uploading $name ($(numfmt --to=iec "$size"))" + if curl -sf -X POST -H "Authorization: token $GITEA_TOKEN" \ + -F "attachment=@$f" \ + "$API/repos/$REPO/releases/$RID/assets?name=$name" \ + | jq -r '" -> " + .browser_download_url'; then + uploaded=$((uploaded+1)) + else + echo "::warning::upload failed for $name" + failed=$((failed+1)) + fi + done + echo "release published: $uploaded uploaded, $failed skipped/failed" + # Only fail the job if NO assets uploaded — a release with zero + # attachments isn't useful to anyone. + [ "$uploaded" -gt 0 ] diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index cb7b432..0000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: "Bug Report" -description: Create a report to help us improve this addon -labels: '🐛 Bug' -body: -- type: markdown - attributes: - value: | - Please search for existing issues before creating a new one. - -- type: textarea - attributes: - label: Description - description: What did you expect to happen and what happened instead? - validations: - required: true - -- type: dropdown - id: flavor - attributes: - label: Realm - description: What realm did this occur on? - options: - - Area 52 (Default) - - Seasonal - - Grizzly Hills - - Rexxar - - Other - validations: - required: true - -- type: checkboxes - id: testing - attributes: - label: Tested with only this addon - description: Did you try having just this addon as the only enabled addon and everything else disabled? - options: - - label: "Yes" - - label: "No" - validations: - required: true - -- type: textarea - attributes: - label: Lua Error - description: | - Do you have an error log of what happened? If you don't see any errors, make sure that error reporting is enabled (`/console scriptErrors 1`) - validations: - required: false - -- type: textarea - attributes: - label: Reproduction Steps - description: Please list out the steps to reproduce your bug. - placeholder: | - 1. Go to '...' - 2. Click on '....' - 3. Scroll down to '....' - 4. See error - validations: - required: true - -- type: input - attributes: - label: Last Good Version - description: | - Was it working in a previous version? If yes, which update did it stop working? If you don't know, when was the last date you were aware it was working - placeholder: "MM/DD/YYYY" - validations: - required: false - -- type: textarea - attributes: - label: Screenshots - description: If applicable, add screenshots to help explain your problem. - placeholder: Click here to attach your screenshots via the editor button in the top right. - validations: - required: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml deleted file mode 100644 index ec4bb38..0000000 --- a/.github/ISSUE_TEMPLATE/config.yml +++ /dev/null @@ -1 +0,0 @@ -blank_issues_enabled: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7..0000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEPMLATE.md b/.github/PULL_REQUEST_TEPMLATE.md deleted file mode 100644 index 30d2afa..0000000 --- a/.github/PULL_REQUEST_TEPMLATE.md +++ /dev/null @@ -1,28 +0,0 @@ -# Description - -Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. - -Fixes #(issue) - -## Type of change - -Please delete options that are not relevant. - -- [ ] Bug fix (non-breaking change which fixes an issue) -- [ ] New feature (non-breaking change which adds functionality) -- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - -## How Has This Been Tested - -Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - -- [ ] Test A -- [ ] Test B - -## Checklist - - -- [ ] I have performed a self-review of my own code -- [ ] I have commented my code, particularly in hard-to-understand areas - - \ No newline at end of file diff --git a/.gitignore b/.gitignore index 44356e3..ec92999 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ .install .lua/* .vscode -.idea \ No newline at end of file +.idea +dist/ diff --git a/Quartz/libs/AceDB-3.0/AceDB-3.0.lua b/Quartz/libs/AceDB-3.0/AceDB-3.0.lua index 231196c..f83a715 100644 --- a/Quartz/libs/AceDB-3.0/AceDB-3.0.lua +++ b/Quartz/libs/AceDB-3.0/AceDB-3.0.lua @@ -111,7 +111,15 @@ local function copyDefaults(dest, src) end else -- Values are not tables, so this is just a simple return - local mt = {__index = function(t,k2) return k2~=nil and v or nil end} + -- (PR #10 backport: the old `k2~=nil and v or nil` short-circuits to + -- nil whenever the default `v` itself is falsy — so `["*"] = false` + -- defaults silently became nil. Make the read explicit instead.) + local mt = { + __index = function(t,k2) + if k2 == nil then return nil end + return v + end, + } setmetatable(dest, mt) end elseif type(v) == "table" then diff --git a/Quartz/libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua b/Quartz/libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua index ee5a83b..07c8f76 100644 --- a/Quartz/libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua +++ b/Quartz/libs/AceGUI-3.0/widgets/AceGUIWidget-Keybinding.lua @@ -199,7 +199,7 @@ local function Constructor() button:SetScript("OnKeyDown", Keybinding_OnKeyDown) button:SetScript("OnMouseDown", Keybinding_OnMouseDown) button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel) - button:SetScript("OnGamePadButtonDown", Keybinding_OnKeyDown) + pcall(button.SetScript, button, "OnGamePadButtonDown", Keybinding_OnKeyDown) button:SetPoint("BOTTOMLEFT") button:SetPoint("BOTTOMRIGHT") button:SetHeight(24) diff --git a/Quartz/modules/Interrupt.lua b/Quartz/modules/Interrupt.lua index 39e854e..be824f8 100644 --- a/Quartz/modules/Interrupt.lua +++ b/Quartz/modules/Interrupt.lua @@ -53,15 +53,9 @@ function Interrupt:ApplySettings() db = self.db.profile end --- 3.3.5 CLEU signature: --- (event, timestamp, subevent, hideCaster, --- srcGUID, srcName, srcFlags, srcRaidFlags, --- destGUID, destName, destFlags, destRaidFlags, --- spellId, spellName, spellSchool, extraSpellId, extraSpellName, extraSpellSchool) -function Interrupt:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, combatEvent, hideCaster, - srcGUID, sourceName, srcFlags, srcRaidFlags, - destGUID, destName, destFlags, destRaidFlags, - spellId, spellName, spellSchool) +-- CoA 3.3.5 uses the standard WotLK 8-arg CLEU layout (no hideCaster/RaidFlags): +-- (event, timestamp, subevent, srcGUID, srcName, srcFlags, destGUID, destName, destFlags, ...) +function Interrupt:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, combatEvent, _, sourceName, _, _, _, destFlags) if combatEvent == "SPELL_INTERRUPT" and destFlags == 0x511 then Player.Bar.Text:SetFormattedText(L["INTERRUPTED (%s)"], (sourceName or UNKNOWN):upper()) Player.Bar.Bar:SetStatusBarColor(unpack(db.interruptcolor)) diff --git a/tools/build_zip.sh b/tools/build_zip.sh new file mode 100755 index 0000000..45d1400 --- /dev/null +++ b/tools/build_zip.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# Build per-addon zip artefacts from HEAD via git-archive. +# +# - Discovers top-level addon folders (Foo/Foo.toc). +# - Re-creates dist/ each run. +# - Always archives HEAD, so the working tree state is irrelevant. +# - If more than one addon folder is present, also emits -all.zip +# with every addon folder side-by-side at the zip root. +# - When run inside Gitea Actions the working tree lives under a +# per-job dir like /var/lib/act_runner/work/.../hostexecutor, so the +# repo name comes from $GITHUB_REPOSITORY (set by the runner) and +# only falls back to the toplevel basename for local invocations. +set -euo pipefail + +root=$(git rev-parse --show-toplevel) +cd "$root" + +# Gitea Actions sets GITHUB_REPOSITORY=owner/repo. The basename of +# `git rev-parse --show-toplevel` inside the runner is the worker dir +# (e.g. `hostexecutor`), which would name the bundle wrong. +if [ -n "${GITHUB_REPOSITORY:-}" ]; then + repo_name="${GITHUB_REPOSITORY##*/}" +else + repo_name=$(basename "$root") +fi +dist="$root/dist" + +# Find Foo/Foo.toc pairs at depth 1; ignore libs nested deeper. +addons=() +while IFS= read -r toc; do + dir=$(dirname "$toc") + folder=$(basename "$dir") + base=$(basename "$toc" .toc) + # Accept Foo.toc and Foo_Wrath.toc style flavour variants; folder must match + # at least one toc basename prefix (Foo). + case "$base" in + "$folder"|"$folder"_*) addons+=("$folder") ;; + esac +done < <(command find . -mindepth 2 -maxdepth 2 -type f -name '*.toc' | sed 's|^\./||' | sort) + +# Dedupe (a folder with Foo.toc + Foo_Wrath.toc shows up twice). +if [ ${#addons[@]} -gt 0 ]; then + mapfile -t addons < <(printf '%s\n' "${addons[@]}" | awk '!seen[$0]++') +fi + +if [ ${#addons[@]} -eq 0 ]; then + echo "no addon folders found (looking for */Foo.toc with matching folder name)" >&2 + exit 1 +fi + +rm -rf "$dist" +mkdir -p "$dist" + +for folder in "${addons[@]}"; do + out="$dist/$folder.zip" + # No --prefix: the folder already sits at the repo root, so git-archive + # emits entries as /... which is exactly what + # Interface/AddOns/ expects after extraction. + git archive HEAD --format=zip -o "$out" -- "$folder" + echo "built dist/$folder.zip" +done + +# Combined bundle only makes sense when there are multiple addons. +if [ ${#addons[@]} -gt 1 ]; then + tmp=$(mktemp -d) + trap 'rm -rf "$tmp"' EXIT + git archive HEAD --format=tar -- "${addons[@]}" | tar -x -C "$tmp" + out="$dist/$repo_name-all.zip" + ( cd "$tmp" && zip -qr "$out" "${addons[@]}" ) + echo "built dist/$repo_name-all.zip" +fi