Skip to content

Commit

Permalink
优选DNS服务器,自动更新hosts文件
Browse files Browse the repository at this point in the history
  • Loading branch information
sinspired committed Oct 15, 2024
1 parent 5db57d5 commit 93a8248
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,30 @@ jobs:
runs-on: ${{ matrix.os }}
permissions:
contents: write

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build executables (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
for script in BestDnsUpdater.py BestHostsUpdater-IPv4.py BestHostsUpdater.py; do
pyinstaller --onefile "$script"
mv "dist/${script%.py}" "dist/${script%.py}-Linux-x64"
done
zip -j "cnNetTool-Linux-x64.zip" dist/*-Linux-x64
- name: Build executables (Windows)
if: matrix.os == 'windows-latest'
run: |
Expand All @@ -48,14 +49,17 @@ jobs:
$exeName = $script -replace '\.py$', ''
Move-Item "dist\$exeName.exe" "dist\$exeName-Windows-x64.exe"
}
Compress-Archive -Path dist\*-Windows-x64.exe -DestinationPath "cnNetTool-Windows-x64.zip"
shell: pwsh

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}-executables
path: dist/*

path: |
cnNetTool-Linux-x64.zip
cnNetTool-Windows-x64.zip
create-release:
needs: build-and-release
runs-on: ubuntu-latest
Expand All @@ -72,7 +76,7 @@ jobs:
delete_release: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -83,11 +87,12 @@ jobs:
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Assets
uses: softprops/action-gh-release@v1
with:
files: |
*-executables/*
cnNetTool-Linux-x64.zip
cnNetTool-Windows-x64.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 93a8248

Please sign in to comment.