Skip to content

Commit 6e89cbe

Browse files
committed
fix: separate gear.json gen and items hash.txt gen into their own actions
this makes the main github action not being slowed down by 20mins while gear.json is created
1 parent 1fd5c22 commit 6e89cbe

File tree

3 files changed

+150
-19
lines changed

3 files changed

+150
-19
lines changed

.github/workflows/hash-files.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,6 @@ jobs:
3636
path: ./wasp-data
3737
fetch-depth: 2
3838

39-
- name: Check if item files changed
40-
id: file_check
41-
shell: bash
42-
working-directory: ./wasp-data
43-
run: |
44-
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^finders/items/data/item.txt$'; then
45-
echo "changed=true" >> $GITHUB_OUTPUT
46-
else
47-
echo "changed=false" >> $GITHUB_OUTPUT
48-
fi
49-
50-
- name: Generate new item files
51-
if: steps.file_check.outputs.changed == 'true'
52-
shell: bash
53-
run: |
54-
ls -a
55-
./Simba-Win64.exe --extractopenssl --run ./wasp-data/tools/update_items.simba
56-
./Simba-Win64.exe --extractopenssl --run ./wasp-data/tools/update_gear.simba
57-
5839
- name: Create hash files
5940
shell: bash
6041
run: |

.github/workflows/update-gear.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Update Files
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
hash-files:
10+
if: ${{ github.repository_owner == 'WaspScripts' }}
11+
runs-on: windows-latest
12+
steps:
13+
- name: Fetch Simba 2 download URL
14+
id: simba-url
15+
run: |
16+
$url = "https://raw.githubusercontent.com/Villavu/Simba-Build-Archive/refs/heads/main/latest.win64"
17+
$response = Invoke-WebRequest -Uri $url -UseBasicParsing
18+
$baseUrl = $response.Content.Trim() -replace 'Win64\.zip\?raw=true$', ''
19+
Write-Output "Base URL: $baseUrl"
20+
echo "::set-output name=baseUrl::$baseUrl"
21+
New-Item -Path ".\Includes" -ItemType Directory
22+
23+
- name: Download Simba 2.0 (64-bit)
24+
run: |
25+
$baseUrl = "${{ steps.simba-url.outputs.baseUrl }}"
26+
$downloadUrl = "$baseUrl" + "Win64.zip?raw=true"
27+
Write-Output "Download URL (64-bit): $downloadUrl"
28+
$outputFile = ".\download.zip"
29+
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile
30+
Expand-Archive -Path $outputFile -DestinationPath . -Force
31+
Remove-Item -Path $outputFile -Force
32+
33+
- name: Checkout repository
34+
uses: actions/[email protected]
35+
with:
36+
path: ./wasp-data
37+
fetch-depth: 2
38+
39+
- name: Check if item files changed
40+
id: file_check
41+
shell: bash
42+
working-directory: ./wasp-data
43+
run: |
44+
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^finders/items/data/item.txt$'; then
45+
echo "changed=true" >> $GITHUB_OUTPUT
46+
else
47+
echo "changed=false" >> $GITHUB_OUTPUT
48+
fi
49+
50+
- name: Generate new gear.json
51+
if: steps.file_check.outputs.changed == 'true'
52+
shell: bash
53+
run: ./Simba-Win64.exe --extractopenssl --run ./wasp-data/tools/update_gear.simba
54+
55+
- name: Create hash files
56+
shell: bash
57+
run: ./Simba-Win64.exe --extractopenssl --run ./wasp-data/tools/hash-files.simba
58+
59+
- name: Commit hash files
60+
shell: bash
61+
run: |
62+
cd ./wasp-data
63+
git config --global user.name "Wasp Bot"
64+
git config --global user.email "[email protected]"
65+
if [[ -n "$(git status --porcelain jsons/gear.json '*.hash')" ]]; then
66+
git add finders/items/data/hash.txt
67+
git add jsons/gear.json
68+
git add '*.hash'
69+
CURRENT_DATE=$(date +'%Y.%m.%d')
70+
COMMIT_HASH=$(git rev-parse --short HEAD)
71+
git commit -m "Automatic version bump to $CURRENT_DATE-$COMMIT_HASH"
72+
git push
73+
else
74+
echo "No hash changes to commit."
75+
fi

.github/workflows/update-items.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Update Files
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
hash-files:
10+
if: ${{ github.repository_owner == 'WaspScripts' }}
11+
runs-on: windows-latest
12+
steps:
13+
- name: Fetch Simba 2 download URL
14+
id: simba-url
15+
run: |
16+
$url = "https://raw.githubusercontent.com/Villavu/Simba-Build-Archive/refs/heads/main/latest.win64"
17+
$response = Invoke-WebRequest -Uri $url -UseBasicParsing
18+
$baseUrl = $response.Content.Trim() -replace 'Win64\.zip\?raw=true$', ''
19+
Write-Output "Base URL: $baseUrl"
20+
echo "::set-output name=baseUrl::$baseUrl"
21+
New-Item -Path ".\Includes" -ItemType Directory
22+
23+
- name: Download Simba 2.0 (64-bit)
24+
run: |
25+
$baseUrl = "${{ steps.simba-url.outputs.baseUrl }}"
26+
$downloadUrl = "$baseUrl" + "Win64.zip?raw=true"
27+
Write-Output "Download URL (64-bit): $downloadUrl"
28+
$outputFile = ".\download.zip"
29+
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile
30+
Expand-Archive -Path $outputFile -DestinationPath . -Force
31+
Remove-Item -Path $outputFile -Force
32+
33+
- name: Checkout repository
34+
uses: actions/[email protected]
35+
with:
36+
path: ./wasp-data
37+
fetch-depth: 2
38+
39+
- name: Check if item files changed
40+
id: file_check
41+
shell: bash
42+
working-directory: ./wasp-data
43+
run: |
44+
if git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -q '^finders/items/data/item.txt$'; then
45+
echo "changed=true" >> $GITHUB_OUTPUT
46+
else
47+
echo "changed=false" >> $GITHUB_OUTPUT
48+
fi
49+
50+
- name: Generate new item files
51+
if: steps.file_check.outputs.changed == 'true'
52+
shell: bash
53+
run: ./Simba-Win64.exe --extractopenssl --run ./wasp-data/tools/update_items.simba
54+
55+
- name: Create hash files
56+
shell: bash
57+
run: ./Simba-Win64.exe --extractopenssl --run ./wasp-data/tools/hash-files.simba
58+
59+
- name: Commit hash files
60+
shell: bash
61+
run: |
62+
cd ./wasp-data
63+
git config --global user.name "Wasp Bot"
64+
git config --global user.email "[email protected]"
65+
if [[ -n "$(git status --porcelain finders/items/data/hash.txt '*.hash')" ]]; then
66+
git add finders/items/data/hash.txt
67+
git add jsons/gear.json
68+
git add '*.hash'
69+
CURRENT_DATE=$(date +'%Y.%m.%d')
70+
COMMIT_HASH=$(git rev-parse --short HEAD)
71+
git commit -m "Automatic version bump to $CURRENT_DATE-$COMMIT_HASH"
72+
git push
73+
else
74+
echo "No hash changes to commit."
75+
fi

0 commit comments

Comments
 (0)