Skip to content

Update Maps

Update Maps #7

Workflow file for this run

name: Update Maps
on:
workflow_run:
workflows: ["Update Hashes"]
types:
- completed
workflow_dispatch:
jobs:
check-maps:
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 '^(map/zips/map.zip|map/zips/heightmap.zip|map/zips/collision.zip)$'; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
process-maps:
if: ${{ github.repository_owner == 'WaspScripts' && needs.check-maps.outputs.changed == 'true' }}
needs: check-maps
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-assets
fetch-depth: 2
- name: Unzip npc files
shell: bash
run: unzip -o ./wasp-assets/map/zips/npc_helper.zip -d ./wasp-assets/map/zips/npc_helper
- name: Generate new npc files
shell: bash
run: ./Simba-Win64.exe --extractopenssl --run ./wasp-assets/tools/update_npcs.simba
- name: Generate new bin files and mapdata.zip
shell: bash
run: ./Simba-Win64.exe --extractopenssl --run ./wasp-assets/tools/update_map.simba
- name: Create hash files
shell: bash
run: ./Simba-Win64.exe --extractopenssl --run ./wasp-assets/tools/hash-files.simba
- name: Commit hash files
shell: bash
run: |
cd ./wasp-assets
git config --global user.name "Wasp Bot"
git config --global user.email "waspbot@waspcripts.com"
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