Merge pull request #23 from WaspScripts/update-2383 #146
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Hashes | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| hash-files: | |
| if: ${{ github.repository_owner == 'WaspScripts' }} | |
| 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: Create hash files | |
| shell: bash | |
| run: | | |
| echo "Before: $(jq . ./wasp-data/hashes.json)" | |
| ./Simba-Win64.exe --extractopenssl --run ./wasp-data/tools/hash-files.simba | |
| echo "After: $(jq . ./wasp-data/hashes.json)" | |
| - name: Commit hashes.json | |
| 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 hash files update" | |
| git push | |
| else | |
| echo "No changes to commit." | |
| fi | |
| - name: Upload files to Database | |
| if: ${{ github.repository_owner == 'WaspScripts' }} | |
| env: | |
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | |
| SUPABASE_KEY: ${{ secrets.SUPABASE_ANON_KEY }} | |
| shell: bash | |
| run: | | |
| cd ./wasp-data | |
| while IFS= read -r file; do | |
| [ -z "$file" ] && continue | |
| if [ ! -f "$file" ]; then | |
| echo "File not found: $file" | |
| continue | |
| fi | |
| remote_path="${file#./}" | |
| mime_type=$(file --mime-type -b "$file") | |
| echo "→ Uploading $remote_path ($mime_type)" | |
| curl -s -X PUT "$SUPABASE_URL/storage/v1/object/data/$remote_path" \ | |
| -H "Authorization: Bearer $SUPABASE_KEY" \ | |
| -H "Content-Type: $mime_type" \ | |
| --data-binary @"$file" | |
| echo "" | |
| done < ./tools/whitelist.txt | |
| notification: | |
| if: ${{ github.repository_owner == 'WaspScripts' && github.ref == 'refs/heads/main' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Discord notification | |
| shell: bash | |
| run: | | |
| BODY=$(jq -nc \ | |
| --arg title "Website Update" \ | |
| --arg desc "${{ github.event.head_commit.message }}" \ | |
| --arg url "https://github.com/WaspScripts/wasp-webapp/commit/${{ github.event.head_commit.id }}" \ | |
| --arg foot "Author: ${{ github.event.head_commit.author.name }}" \ | |
| --argjson color 16742912 \ | |
| '{embeds:[{title:$title,description:$desc,url:$url,color:$color,footer:{text:$foot}}]}') | |
| curl \ | |
| -H "Content-Type: application/json" \ | |
| -d "$BODY" \ | |
| ${{ secrets.UPDATES_WEBHOOK }} |