Skip to content

调整 构建下载参数设置 #166

调整 构建下载参数设置

调整 构建下载参数设置 #166

Workflow file for this run

name: Build Dev
on:
workflow_dispatch:
push:
paths-ignore:
- '.github/*'
- '*.md'
pull_request:
paths-ignore:
- '.github/*'
- '*.md'
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Change DNS Server
shell: pwsh
run: |
$newDnsServers = @('1.1.1.1', '8.8.8.8')
$networkAdapters = Get-NetAdapter | Where-Object { $_.Status -eq 'Up' }
foreach ($adapter in $networkAdapters) {
Set-DnsClientServerAddress -InterfaceIndex $adapter.ifIndex -ResetServerAddresses
Set-DnsClientServerAddress -InterfaceIndex $adapter.ifIndex -ServerAddresses $newDnsServers
}
ipconfig /flushdns
- name: Install Cloudflare WRAP
shell: pwsh
run: |
Write-Host "installing Cloudflare WARP..."
Invoke-WebRequest -Uri "https://1111-releases.cloudflareclient.com/win/latest" -OutFile "C:\cfwarp.msi"
Start-Process "msiexec.exe" -ArgumentList "/i C:\cfwarp.msi /qn" -Wait
Set-Location "C:\Program Files\Cloudflare\Cloudflare WARP"
.\warp-cli.exe registration new
.\warp-cli.exe connect
# Add a loop to wait for the status to be connected
for ($attemptCount = 0; $attemptCount -lt 10; $attemptCount++) {
$output = .\warp-cli.exe status
Write-Host $output
if ($output -like "*Status update: Connected*") {
break
}
Start-Sleep -Seconds 5 # Wait for 5 seconds before checking again
}
if ($attemptCount -eq 10) {
Write-Host "Failed to connect after 10 attempts."
exit 1 # Exit with an error code
}
- name: Generate version based on current date and time
id: generate_version
shell: pwsh
run: |
Set-TimeZone -Id "China Standard Time" -PassThru
$date = Get-Date
$year = $date.Year.ToString().Substring(2)
$month = $date.Month.ToString("0")
$day = $date.Day.ToString("0")
$hour = $date.Hour.ToString("0")
$minute = $date.Minute.ToString("0")
$version = "$year.$month.$day.$hour$minute"
echo "Version: $version"
echo $PSVersionTable
echo $GITHUB_OUTPUT
echo "version=$version" >> $env:GITHUB_OUTPUT
# - name: Install NSIS
# uses: repolevedavaj/[email protected]
# with:
# nsis-version: 3.09
- name: Build XROSC
shell: pwsh
env:
GITHUB_WORKFLOW_VERSION: ${{ steps.generate_version.outputs.version }}
run: |
. .\build.ps1
- name: Disconnect Cloudflare WRAP
shell: pwsh
run: |
Set-Location "C:\Program Files\Cloudflare\Cloudflare WARP"
.\warp-cli.exe disconnect
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: XRSYS_OSC_CI_Build_v${{ steps.generate_version.outputs.version }}
path: osc.exe
compression-level: 0