Repository navigation
62 lines (52 loc) · 2.8 KB
/
Copy pathinterface-version.yml
File metadata and controls
62 lines (52 loc) · 2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Update TOC Interface version(s)
on:
workflow_dispatch:
schedule:
- cron: 0 12 * * *
permissions:
contents: write
pull-requests: write
jobs:
run:
name: TOCcheck
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v6
- name: Update TOC Interface versions
uses: p3lim/toc-interface-updater@v4
with:
flavor: retail
- name: Preserve WoW Forever interface
run: |
TOC="PersonalPlayerNotes.toc"
retail=$(grep -m1 '^## Interface: ' "$TOC" | sed 's/.*: //' | cut -d, -f1 | tr -d ' \r')
sed -i "s/^## Interface:.*/## Interface: ${retail}, 16001/" "$TOC"
- name: Update badge JSON files
run: |
toc_to_version() {
local v="$1"
printf "%d.%d.%d" $((10#${v:0:-4})) $((10#${v: -4:2})) $((10#${v: -2:2}))
}
TOC="PersonalPlayerNotes.toc"
mkdir -p .github/badges
interfaces=$(grep -m1 '^## Interface: ' "$TOC" | sed 's/.*: //' | tr -d ' \r')
retail=$(printf '%s' "$interfaces" | cut -d, -f1 | tr -d ' ')
forever=$(printf '%s' "$interfaces" | cut -d, -f2 | tr -d ' ')
vanilla=$(grep -m1 '^## Interface-Vanilla: ' "$TOC" | sed 's/.*: //' | tr -d ' \r')
tbc=$(grep -m1 '^## Interface-TBC: ' "$TOC" | sed 's/.*: //' | tr -d ' \r')
mists=$(grep -m1 '^## Interface-Mists: ' "$TOC" | sed 's/.*: //' | tr -d ' \r')
[ -n "$retail" ] && printf '{"schemaVersion":1,"label":"Retail","message":"%s","color":"0070DD","style":"flat-square"}\n' "$(toc_to_version "$retail")" > .github/badges/retail.json
[ -n "$vanilla" ] && printf '{"schemaVersion":1,"label":"Classic Era","message":"%s","color":"A335EE","style":"flat-square"}\n' "$(toc_to_version "$vanilla")" > .github/badges/vanilla.json
[ -n "$tbc" ] && printf '{"schemaVersion":1,"label":"TBC Anniversary","message":"%s","color":"C69B3A","style":"flat-square"}\n' "$(toc_to_version "$tbc")" > .github/badges/tbc.json
[ -n "$mists" ] && printf '{"schemaVersion":1,"label":"Mists Classic","message":"%s","color":"1EFF00","style":"flat-square"}\n' "$(toc_to_version "$mists")" > .github/badges/mists.json
[ -n "$forever" ] && printf '{"schemaVersion":1,"label":"WoW Forever","message":"%s","color":"00A3E0","style":"flat-square"}\n' "$(toc_to_version "$forever")" > .github/badges/forever.json
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
commit-message: 'Update TOC interface version(s)'
branch: 'ci/toc-interface-update'
delete-branch: true
title: 'Update TOC interface version(s)'
body: 'Automated TOC interface version update.'
labels: 'maintenance'