Skip to content

Commit

Permalink
Start refactor of wowtools script
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanzilla committed Apr 3, 2024
1 parent 875408e commit fa8c51e
Show file tree
Hide file tree
Showing 21 changed files with 848,811 additions and 619,346 deletions.
1 change: 1 addition & 0 deletions .github/scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.csv
.wowtools.json
.wago_tools.json
atlas.lua
1 change: 1 addition & 0 deletions .github/scripts/.last_wow_build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
acb4ae782e4c990ef764592e78bc9e85
1 change: 1 addition & 0 deletions .github/scripts/.last_wow_classic_beta_build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
80b9d29886861d6f0225de09ca1d0476
1 change: 1 addition & 0 deletions .github/scripts/.last_wow_classic_build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ac0b091d8852985a2ce03e416fbf1cf1
1 change: 1 addition & 0 deletions .github/scripts/.last_wow_classic_era_build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5a468991f9812a6d3b2e08575c1211c2
1 change: 0 additions & 1 deletion .github/scripts/.lastclassicwowbuild

This file was deleted.

1 change: 0 additions & 1 deletion .github/scripts/.lastwow_classic_erabuild

This file was deleted.

1 change: 0 additions & 1 deletion .github/scripts/.lastwow_classicbuild

This file was deleted.

1 change: 0 additions & 1 deletion .github/scripts/.lastwowbuild

This file was deleted.

19 changes: 12 additions & 7 deletions .github/scripts/csv_to_lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@

local releases = {
wow_classic_era = {
input = "wow_classic_era_list.csv", -- get it from https://wow.tools/casc/listfile/download/csv/build?buildConfig=9ad6ad5306deb8eed364b64cc628ac98
input = "wow_classic_era.csv",
output = "ModelPathsClassic.lua",
generate = true
},
wow_classic = {
input = "wow_classic_list.csv", -- get it from https://wow.tools/casc/listfile/download/csv/build?buildConfig=9ad6ad5306deb8eed364b64cc628ac98
output = "ModelPathsBCC.lua",
input = "wow_classic.csv",
output = "ModelPathsWrath.lua",
generate = true
},
wow_classic_beta = {
input = "wow_classic_beta.csv",
output = "ModelPathsCata.lua",
generate = true
},
wow = {
input = "wow_list.csv", -- get it from https://wow.tools/casc/listfile/download/csv/build?buildConfig=26291f284f42494375d511d1fc120216 (last retail build when i write that)
input = "wow.csv",
output = "ModelPaths.lua",
generate = true
}
Expand All @@ -23,7 +28,7 @@ local releases = {
require "table"

if not arg[1] or not releases[arg[1]] then
print(arg[0], "<wow|wow_classic|wow_classic_era>")
print(arg[0], "<wow|wow_classic|wow_classic_beta|wow_classic_era>")
return
end

Expand Down Expand Up @@ -122,9 +127,9 @@ local info = releases[arg[1]]
if info and info.generate then
local models = {}
for line in io.lines(info.input) do
local fileid, file = line:match("(%d*);(.*)")
local fileId, file = line:match("(%d*);(.*)")
if file and file:match("%.m2$") then
recurseSet(models, file, fileid)
recurseSet(models, file, fileId)
end
end

Expand Down
File renamed without changes.
32 changes: 32 additions & 0 deletions .github/scripts/update-model-paths.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

update_model_paths() {
branch=$1

build_config=$(jq -r ".${branch}.build_config" < .wago_tools.json)
if [ -z "${build_config}" ] || [ "${build_config}" == "null" ]; then
echo "${branch} build_config not found in .wago_tools.json"
else
lastbuildfile=".last_${branch}_build"
if [ -f "${lastbuildfile}" ] && [[ ${build_config} == $(cat "${lastbuildfile}") ]]; then
echo "${branch} build_config has not changed"
else
echo "New ${branch} build detected"
csvfile="${branch}.csv"
wget -O "${csvfile}" "https://wago.tools/api/files?branch=${branch}&search=.m2&format=csv" || { echo "Error while downloading ${csvfile}"; exit 1; }
echo "${build_config}" > "${lastbuildfile}"
lua csv_to_lua.lua "${branch}" || { echo "Error while creating ${branch}.lua"; exit 1; }
fi
fi
}

wget -O ".wago_tools.json" "https://wago.tools/api/builds/latest" || { echo "Error while downloading .wago_tools.json"; exit 1; }

branches=("wow" "wow_classic" "wow_classic_beta" "wow_classic_era")

for branch in "${branches[@]}"
do
update_model_paths "$branch"
done

mv ModelPaths*.lua ../../WeakAurasModelPaths/
35 changes: 0 additions & 35 deletions .github/scripts/wowtools.sh

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/atlas-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Create Atlas File List Update Pull Request
on:
schedule:
- cron: "0 10 * * 1"

workflow_dispatch:

jobs:
Expand All @@ -22,7 +21,7 @@ jobs:
- name: Update Atlas Files from wago.tools
run: |
cd .github/scripts/
./wagotools-atlas.sh
./update-atlas-files.sh
shell: bash

- name: Cleanup Luarocks
Expand All @@ -35,4 +34,5 @@ jobs:
branch: update-atlasfiles
commit-message: Update Atlas File List from wago.tools
title: Update Atlas File List from wago.tools
body: Update Atlas File List from wago.tools
delete-branch: true
28 changes: 28 additions & 0 deletions .github/workflows/modelpaths-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Create WeakAurasModelPaths Update Pull Request

on:
schedule:
- cron: '0 10 * * *'
workflow_dispatch:

jobs:
modelPathsUpdate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: leafo/gh-actions-lua@v10

- name: Update WeakAurasModelPaths from wago.tools
run: |
cd .github/scripts/
./update-model-paths.sh
shell: bash

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: update-modelpaths
commit-message: Update WeakAurasModelPaths from wago.tools
title: Update WeakAurasModelPaths from wago.tools
body: Update WeakAurasModelPaths from wago.tools
delete-branch: true
28 changes: 0 additions & 28 deletions .github/workflows/modelpaths-update.yml.disabled

This file was deleted.

1 change: 1 addition & 0 deletions .luarc.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@
],
"runtime.version": "Lua 5.1",
"workspace.ignoreDir": [
".github",
".vscode",
"WeakAurasModelPaths",
"WeakAuras/Libs"
Expand Down
Loading

0 comments on commit fa8c51e

Please sign in to comment.