Enhance dashboard card structures and status handling (#23) #89
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: Build Satellite on staging server | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| env: | |
| BIN_PATH: 'D:\bin' | |
| TEMP_PATH: 'D:\deployment' | |
| SERVICES: 'StorjSatellite' | |
| jobs: | |
| build-satellite: | |
| runs-on: [self-hosted, windows, staging] | |
| environment: staging | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| clean: true | |
| - name: Build satellite.exe | |
| env: | |
| WEB3_AUTH_PRIVATE_KEY: ${{ secrets.WEB3_AUTH_PRIVATE_KEY }} | |
| run: | | |
| go build -ldflags "-s -w -X 'storj.io/storj/satellite/console/secretconstants.Web3AuthPrivateKey=$env:WEB3_AUTH_PRIVATE_KEY'" -o "$env:TEMP_PATH\satellite.exe" ./cmd/satellite | |
| - name: Quick service stop | |
| run: | | |
| Set-Location $env:BIN_PATH | |
| $status = (Get-Service -Name StorjSatellite -ErrorAction SilentlyContinue).Status | |
| if ($status -eq "Running" -or $status -eq "Paused" -or $status -eq "StartPending") { | |
| & ".\nssm.exe" stop StorjSatellite 2>&1 | Out-Null | |
| Start-Sleep -Seconds 2 # Reduced wait time | |
| } | |
| - name: Quick file replacement | |
| run: | | |
| # Minimal file operations | |
| if (Test-Path "$env:BIN_PATH\satellite.exe") { | |
| Remove-Item "$env:BIN_PATH\satellite.exe" -Force -ErrorAction SilentlyContinue | |
| } | |
| Move-Item "$env:TEMP_PATH\satellite.exe" "$env:BIN_PATH\satellite.exe" -Force | |
| Write-Host "satellite.exe replaced" | |
| - name: Quick service start | |
| run: | | |
| Set-Location $env:BIN_PATH | |
| $service = Get-Service -Name StorjSatellite -ErrorAction SilentlyContinue | |
| if (-not $service) { | |
| Write-Host "Service not found" | |
| exit 0 | |
| } | |
| # Wait for service to stabilize if transitioning | |
| $maxWait = 10 | |
| while ($maxWait -gt 0 -and ($service.Status -match "Pending")) { | |
| Start-Sleep -Seconds 1 | |
| $service.Refresh() | |
| $maxWait-- | |
| } | |
| if ($service.Status -eq "Stopped") { | |
| $ErrorActionPreference = "Continue" | |
| $result = & cmd /c ".\nssm.exe" start StorjSatellite 2>&1 | Out-String | |
| $ErrorActionPreference = "Stop" | |
| Start-Sleep -Seconds 3 | |
| $service.Refresh() | |
| # Handle StartPending error (service is actually starting) | |
| if ($result -match "SERVICE_START_PENDING" -or $service.Status -eq "Running" -or $service.Status -eq "StartPending") { | |
| Write-Host "Service started successfully (Status: $($service.Status))" | |
| exit 0 | |
| } | |
| } elseif ($service.Status -eq "Running") { | |
| Write-Host "Service already running" | |
| exit 0 | |
| } else { | |
| Write-Host "Service in unexpected state: $($service.Status)" | |
| } |