Skip to content

Commit ddb9727

Browse files
committed
feat: make github action upload files to supabase
1 parent 638ec53 commit ddb9727

File tree

3 files changed

+37
-9
lines changed

3 files changed

+37
-9
lines changed

.github/workflows/hash-files.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
run: |
4242
./Simba-Win64.exe --extractopenssl --run ./wasp-data/tools/hash-files.simba
4343
44-
- name: Commit hash files
44+
- name: Commit hashes.json
4545
shell: bash
4646
run: |
4747
cd ./wasp-data
@@ -54,8 +54,35 @@ jobs:
5454
else
5555
echo "No changes to commit."
5656
fi
57-
58-
57+
58+
- name: Upload files to Database
59+
if: ${{ github.repository_owner == 'WaspScripts' }}
60+
env:
61+
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
62+
SUPABASE_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
63+
shell: bash
64+
run: |
65+
cd ./wasp-data
66+
find . -type f \
67+
! -path "*/.git/*" \
68+
! -path "./.git/*" \
69+
! -path "./.github/*" \
70+
! -name ".gitignore" \
71+
! -name ".gitattributes" \
72+
! -name "LICENSE" \
73+
! -name "README.md" \
74+
! -name "*.simba" \
75+
| while read file; do
76+
remote_path="${file#./}"
77+
mime_type=$(file --mime-type -b "$file")
78+
echo "→ Uploading $remote_path ($mime_type)"
79+
curl -s -X PUT "$SUPABASE_URL/storage/v1/object/data/$remote_path" \
80+
-H "Authorization: Bearer $SUPABASE_KEY" \
81+
-H "Content-Type: $mime_type" \
82+
--data-binary @"$file"
83+
echo ""
84+
done
85+
5986
notification:
6087
if: ${{ github.repository_owner == 'WaspScripts' && github.ref == 'refs/heads/main' }}
6188
runs-on: ubuntu-latest

hashes.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"data\\items.zip" : "E8AAA65A",
3-
"data\\monsters.txt" : "81455CA5",
3+
"data\\monsters.txt" : "E4AC5B2E",
44
"data\\monsters.zip" : "83299037",
55
"finders\\house_layout.zip" : "D6FF199D",
6-
"finders\\items\\data\\hash.txt" : "08C25E38",
6+
"finders\\items\\data\\hash.txt" : "79AA9872",
77
"finders\\items\\data\\id.txt" : "13500FED",
88
"finders\\items\\data\\item.txt" : "E9BA7D65",
99
"finders\\items\\items-imgs.zip" : "909DE512",
10-
"finders\\items\\items.bin" : "584C7189",
10+
"finders\\items\\items.bin" : "E61C0CEC",
1111
"finders\\items\\items.zip" : "88F96D49",
1212
"finders\\overheads.zip" : "1F4D08DA",
1313
"finders\\prayer.zip" : "0ADB50ED",
@@ -17,12 +17,12 @@
1717
"images\\gametab.png" : "01E8D551",
1818
"images\\mm_fixed_mask.png" : "A3215DDA",
1919
"images\\mm_resizable_mask.png" : "34785F87",
20-
"jsons\\consumables.json" : "5F2994A1",
21-
"jsons\\gear.json" : "82CE8D4A",
20+
"jsons\\consumables.json" : "D0945586",
21+
"jsons\\gear.json" : "0C3B92C6",
2222
"jsons\\item-definitions.zip" : "E8AAA65A",
2323
"jsons\\monsters" : "E4AC5B2E",
2424
"jsons\\monsters.zip" : "83299037",
25-
"jsons\\weapons.json" : "670C3284",
25+
"jsons\\weapons.json" : "1A3B8320",
2626
"map\\collision.zip" : "CEA054AC",
2727
"map\\heightmap.zip" : "9B22E98B",
2828
"map\\map.zip" : "EADCA8B3",

tools/hash-files.simba

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@ begin
3232
json.AddString(files[i].After(path), hash);
3333
end;
3434

35+
WriteLn json.Format();
3536
json.Save(path + 'hashes.json');
3637
end.

0 commit comments

Comments
 (0)