Files
SpotX/.github/workflows/check_spotx.yml
T

127 lines
5.5 KiB
YAML

name: Check Spotx for the latest Spotify
run-name: Check SpotX for Spotify ${{ inputs.version || 'latest' }}
on:
workflow_dispatch:
inputs:
version:
description: Spotify version like 1.2.95 or 1.2.95.453, empty means latest
required: false
default: ''
type: string
jobs:
build:
runs-on: windows-latest
steps:
- name: Prepare checks
id: prepare
shell: powershell
env:
SPOTIFY_VERSION: ${{ inputs.version }}
run: |
$spotifyVersion = ([string]$env:SPOTIFY_VERSION).Trim()
if ([string]::IsNullOrWhiteSpace($spotifyVersion)) {
$jsonUrl = "https://raw.githubusercontent.com/LoaderSpot/table/refs/heads/main/table/versions.json"
$resp = Invoke-RestMethod -Uri $jsonUrl
# Use fullversion for the installer name
$latestEntry = $resp.PSObject.Properties | Select-Object -First 1
if (-not $latestEntry) {
throw "No Spotify versions found in $jsonUrl"
}
$spotifyVersion = [string]$latestEntry.Value.fullversion
if ([string]::IsNullOrWhiteSpace($spotifyVersion) -or $spotifyVersion -notmatch '^\d+\.\d+\.\d+\.\d+\.g[0-9a-f]+$') {
throw "Invalid Spotify fullversion for $($latestEntry.Name)"
}
}
elseif ($spotifyVersion -notmatch '^\d+\.\d+\.\d+(?:\.\d+)?$') {
throw "Invalid Spotify version: $spotifyVersion"
}
Write-Host "Selected Spotify version: $spotifyVersion"
# Incoming parameters
$parameters = @{
Verbose = $true
no_pause = $true
new_theme = $true
version = $spotifyVersion
confirm_spoti_recomended_over = $true
cache_limit = 1000
block_update_on = $true
lyrics_stat = "spotify"
urlform_goofy = "https://docs.google.com/forms/formResponse"
idbox_goofy = "9999999"
podcasts_off = $true
adsections_off = $true
lyrics_block = $true
}
$spotxUrl = "https://raw.githubusercontent.com/SpotX-Official/SpotX/refs/heads/main/run.ps1"
Invoke-WebRequest -UseBasicParsing -Uri $spotxUrl -OutFile "$env:RUNNER_TEMP\spotx.ps1"
$parameters | Export-Clixml -LiteralPath "$env:RUNNER_TEMP\spotx-parameters.xml"
- name: Run SpotX (x64)
shell: powershell
run: |
$parameters = Import-Clixml -LiteralPath "$env:RUNNER_TEMP\spotx-parameters.xml"
$spotxScript = [scriptblock]::Create((Get-Content -LiteralPath "$env:RUNNER_TEMP\spotx.ps1" -Raw -Encoding UTF8))
& $spotxScript @parameters
- name: Run SpotX (ARM64 files)
if: ${{ !cancelled() && steps.prepare.outcome == 'success' }}
shell: powershell
run: |
$parameters = Import-Clixml -LiteralPath "$env:RUNNER_TEMP\spotx-parameters.xml"
$checkVersion = $parameters.version
$installedSpotify = Join-Path $env:APPDATA 'Spotify\Spotify.exe'
if (Test-Path -LiteralPath $installedSpotify) {
$checkVersion = (Get-Item -LiteralPath $installedSpotify).VersionInfo.FileVersion
}
$jsonUrl = 'https://raw.githubusercontent.com/LoaderSpot/table/refs/heads/main/table/versions.json'
$manifest = Invoke-RestMethod -Uri $jsonUrl
$entry = $manifest.PSObject.Properties | Where-Object {
$_.Name -eq $checkVersion -or $_.Value.fullversion -eq $checkVersion -or
($checkVersion -match '^\d+\.\d+\.\d+$' -and $_.Name.StartsWith("$checkVersion."))
} | Sort-Object { [version]$_.Name } -Descending | Select-Object -First 1
$installer = $entry.Value.win.arm64
if (-not $installer.url -or $installer.size -le 0) {
throw "No ARM64 installer found for Spotify $checkVersion"
}
if ($entry.Value.fullversion -notmatch '^\d+\.\d+\.\d+\.\d+\.g[0-9a-f]+$') {
throw "Invalid Spotify fullversion for $checkVersion"
}
$installerPath = Join-Path $env:RUNNER_TEMP 'SpotifySetup-arm64.exe'
Write-Host "ARM64 Spotify version: $($entry.Value.fullversion)"
Write-Host "Source: $($installer.url)"
for ($attempt = 1; $attempt -le 3; $attempt++) {
Write-Host "ARM64 installer download attempt $attempt/3"
curl.exe -q -L --fail-with-body --connect-timeout 15 --progress-bar -o $installerPath --url $installer.url
if ($LASTEXITCODE -eq 0) {
$downloadedSize = (Get-Item -LiteralPath $installerPath).Length
if ($downloadedSize -eq $installer.size) { break }
Write-Warning "ARM64 installer size mismatch: expected $($installer.size), got $downloadedSize"
}
if ($attempt -eq 3) { throw 'ARM64 installer download failed after 3 attempts' }
Start-Sleep -Seconds 5
}
$unpackerUrl = 'https://raw.githubusercontent.com/SpotX-Official/Spotify-EXE-Unpacker/refs/heads/main/spotify_exe_unpacker.py'
$unpackerPath = Join-Path $env:RUNNER_TEMP 'spotify_exe_unpacker.py'
Invoke-WebRequest -UseBasicParsing -Uri $unpackerUrl -OutFile $unpackerPath
$parameters.SpotifyPath = Join-Path $env:RUNNER_TEMP 'Spotify-arm64'
$parameters.version = $entry.Value.fullversion
$parameters.defender_exclusions_off = $true
python $unpackerPath $installerPath --output $parameters.SpotifyPath
if ($LASTEXITCODE -ne 0) { throw 'ARM64 installer extraction failed' }
$spotxScript = [scriptblock]::Create((Get-Content -LiteralPath "$env:RUNNER_TEMP\spotx.ps1" -Raw -Encoding UTF8))
& $spotxScript @parameters