Skip to content

Commit

Permalink
Update cf-win.msvc.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
mguludag authored May 20, 2024
1 parent 4268bb2 commit a936185
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/cf-win.msvc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,28 @@ jobs:
- run: Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False
- run: Set-LocalUser -Name "runneradmin" -Password (ConvertTo-SecureString -AsPlainText "Compiler-Explorer" -Force)
- run: Invoke-WebRequest https://raw.githubusercontent.com/mguludag/github-actions-run-compiler-explorer/main/setup-ce.ps1 -OutFile C:\setup-ce.ps1
- run: Invoke-WebRequest https://github.com/mguludag/pwsh_send_telegram_bot/raw/main/send_telegram.ps1 -OutFile C:\send_telegram.ps1

- run: powercfg -setacvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c SUB_PROCESSOR PROCTHROTTLEMAX 80
- run: powercfg -setdcvalueindex 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c SUB_PROCESSOR PROCTHROTTLEMAX 80



- name: Run localtunnel and compiler-explorer
- name: Run cloudflared and compiler-explorer
run: |
Start-Process -FilePath "powershell.exe" -ArgumentList "C:\setup-ce.ps1"
$Client = New-Object System.Net.Sockets.TcpClient
while($true){ try{ $Client.Connect("localhost", 10240) }catch{} if($Client.Connected){ break } Start-Sleep -s 1 }
Start-Sleep -s 3
cloudflared tunnel --url http://localhost:10240
if($Env:TG_TOKEN -ne $null -and $Env:TG_TOKEN -ne ""){
$URLString = $null
Start-Process -FilePath "powershell.exe" -ArgumentList "C:\setup-ce.ps1" -RedirectStandardOutput $pwd\out.txt -RedirectStandardError $pwd\err.txt
Start-Sleep -s 10
Get-Content $pwd\out.txt | ForEach-Object { if($_ -match "https://"){ $URLString = ((Select-String '(http[s]?)(:\/\/)([^\s,]+)(?=")' -Input $Text).Matches.Value) }}
if($URLString){ C:\send_telegram.ps1 ${{ secrets.TG_TOKEN }} ${{ secrets.TG_CHAT_ID }} $URLString }
}else{
cloudflared tunnel --url http://localhost:10240
}
env:
TG_TOKEN: ${{ secrets.TG_TOKEN }}

0 comments on commit a936185

Please sign in to comment.