From 775d85d76fd50b06c09534fcf22a952aa835ebb5 Mon Sep 17 00:00:00 2001 From: xrgzs Date: Mon, 3 Jun 2024 18:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=20CI=20DNS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 13 ++++++++++++- .github/workflows/release.yml | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad56678..5dc874f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,18 @@ jobs: 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: Generate version based on current date and time id: generate_version shell: pwsh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 70633b5..bc425c3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,7 +9,18 @@ jobs: 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: Generate version based on current date and time id: generate_version shell: pwsh