Remove temporary Vendor Values generator

This commit is contained in:
Dusk-92
2026-08-24 11:20:28 +02:00
parent 338e543b02
commit 6f2b81c835
-105
View File
@@ -1,105 +0,0 @@
name: Temporary Vendor Values DB Generator
# Temporary one-shot generator for the Turtle WoW static vendor database.
on:
push:
branches: [classicapi-enhanced]
paths:
- '.github/workflows/temp-vendor-values.yml'
permissions:
contents: write
jobs:
generate:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- name: Checkout ShaguTweaks
uses: actions/checkout@v4
with:
ref: classicapi-enhanced
- name: Checkout Tortoise DB Viewer
uses: actions/checkout@v4
with:
repository: Xian55/tortoise-db-viewer
path: .vendor-build/viewer
- name: Checkout Turtle WoW SQL
uses: actions/checkout@v4
with:
repository: Penqle/tortoise-wow
path: .vendor-build/server
sparse-checkout: |
sql/base
sql/database_updates
sparse-checkout-cone-mode: false
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install viewer dependencies
working-directory: .vendor-build/viewer
run: bun install
- name: Build migrated Turtle SQLite
working-directory: .vendor-build/viewer
env:
SQL_DIR: ${{ github.workspace }}/.vendor-build/server/sql/base
run: bun scripts/build-db.mjs
- name: Regenerate Vendor Values table
shell: python
run: |
import sqlite3
from pathlib import Path
db_path = Path('.vendor-build/viewer/public/data/tortoise.sqlite')
target = Path('mods/vendor-values.lua')
con = sqlite3.connect(db_path)
rows = con.execute(
'SELECT entry, sell_price FROM items WHERE sell_price > 0 ORDER BY entry'
).fetchall()
con.close()
entries = [f'[{item_id}]={price}' for item_id, price in rows]
lines = [' ' + ', '.join(entries[i:i + 6]) + ',' for i in range(0, len(entries), 6)]
block = (
'-- Vendor prices generated from Penqle/tortoise-wow through the migrated Tortoise DB Viewer build.\n'
'-- Values are per-item vendor sell prices in copper; unsellable (0-price) items are omitted.\n'
'local data = {\n' + '\n'.join(lines) + '\n}\n'
)
text = target.read_text(encoding='utf-8')
start_marker = 'local data = {'
next_marker = 'if GetExpansion() == "tbc" then'
start = text.find(start_marker)
next_pos = text.find(next_marker, start + len(start_marker)) if start >= 0 else -1
if start < 0 or next_pos < 0:
raise SystemExit(
f'Could not locate Vendor Values data block (start={start}, next={next_pos})'
)
# Keep the surrounding module untouched. The historical data table may end
# with its closing brace on the same line as the final item, so do not rely
# on a formatting-sensitive regular expression here.
new_text = text[:start] + block + '\n\n' + text[next_pos:]
target.write_text(new_text, encoding='utf-8', newline='\n')
print(f'Generated {len(rows)} sellable item prices')
print(f'Highest item ID: {rows[-1][0] if rows else 0}')
print(f'File size: {target.stat().st_size} bytes')
- name: Commit generated database
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add mods/vendor-values.lua
git diff --cached --stat
git diff --cached --quiet && exit 0
git commit -m "Update Vendor Values database for Turtle WoW 1.18.1"
git push origin HEAD:classicapi-enhanced