-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (34 loc) · 2.29 KB
/
cf-win.msvc.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: compiler-explorer-win-msvc-cf
on: [push, workflow_dispatch]
jobs:
build:
runs-on: windows-latest
steps:
- run: choco install cloudflared
- 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 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
if($Env:TG_TOKEN -ne $null -and $Env:TG_TOKEN -ne ""){
$URLString = $null
Start-Process -FilePath "cloudflared.exe" -ArgumentList "--url http://localhost:10240" -RedirectStandardOutput $pwd\out.txt -RedirectStandardError $pwd\err.txt
Start-Sleep -s 10
Get-Content $pwd\out.txt | ForEach-Object { if($_ -match "https://"){ $str = ((Select-String '(ftp|ftps|sftp|http|https)://(\S)*' -Input $_).Matches.Value); if($str.EndsWith('com')){ $URLString = $str } }}
Get-Content $pwd\err.txt | ForEach-Object { if($_ -match "https://"){ $str = ((Select-String '(ftp|ftps|sftp|http|https)://(\S)*' -Input $_).Matches.Value); if($str.EndsWith('com')){ $URLString = $str } }}
if($URLString){ C:\send_telegram.ps1 ${{ secrets.TG_TOKEN }} ${{ secrets.TG_CHAT_ID }} $URLString }
Get-Content $pwd\out.txt
Get-Content $pwd\err.txt
Start-Sleep -s 21600
}else{
cloudflared tunnel --url http://localhost:10240
}
env:
TG_TOKEN: ${{ secrets.TG_TOKEN }}