Skip to content

Update Items

Update Items #74

Workflow file for this run

name: Update Items
on:
workflow_run:
workflows: ["Update Hashes"]
types:
- completed
workflow_dispatch:
jobs:
check-items:
if: ${{ github.repository_owner == 'WaspScripts' }}
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.file_check.outputs.changed }}
steps:
- name: Checkout repo
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Check if item files changed
id: file_check
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "Manual run detected."
echo "changed=true" >> $GITHUB_OUTPUT
elif git diff --name-only ${{ github.event.workflow_run.head_sha }}^ ${{ github.event.workflow_run.head_sha }} \
| grep -Eq '^(finders/items/data/item.txt|finders/items/data/id.txt|finders/items/items-imgs.zip)$'; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
process-items:
if: ${{ github.repository_owner == 'WaspScripts' && needs.check-items.outputs.changed == 'true' }}
needs: check-items
runs-on: windows-latest
steps:
- name: Fetch Simba 2 download URL
id: simba-url
run: |
$url = "https://raw.githubusercontent.com/Villavu/Simba-Build-Archive/refs/heads/main/latest.win64"
$response = Invoke-WebRequest -Uri $url -UseBasicParsing
$baseUrl = $response.Content.Trim() -replace 'Win64\.zip\?raw=true$', ''
Write-Output "Base URL: $baseUrl"
echo "::set-output name=baseUrl::$baseUrl"
New-Item -Path ".\Includes" -ItemType Directory
- name: Download Simba 2.0 (64-bit)
run: |
$baseUrl = "${{ steps.simba-url.outputs.baseUrl }}"
$downloadUrl = "$baseUrl" + "Win64.zip?raw=true"
Write-Output "Download URL (64-bit): $downloadUrl"
$outputFile = ".\download.zip"
Invoke-WebRequest -Uri $downloadUrl -OutFile $outputFile
Expand-Archive -Path $outputFile -DestinationPath . -Force
Remove-Item -Path $outputFile -Force
- name: Checkout repository
uses: actions/checkout@v5
with:
path: ./wasp-data
fetch-depth: 2
- name: Generate new item files
shell: bash
run: ./Simba-Win64.exe --extractopenssl --run ./wasp-data/tools/update_items.simba
- name: Create hash files
shell: bash
run: ./Simba-Win64.exe --extractopenssl --run ./wasp-data/tools/hash-files.simba
- name: Commit hash files
shell: bash
run: |
cd ./wasp-data
git config --global user.name "Wasp Bot"
git config --global user.email "[email protected]"
if [[ -n "$(git status --porcelain)" ]]; then
git add -A
git commit -m "Automatic items files update"
git push
else
echo "No changes to commit."
fi