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 f135ae3 commit c2bd2ad
Show file tree
Hide file tree
Showing 6 changed files with 1,708 additions and 1 deletion.
70 changes: 70 additions & 0 deletions .github/workflows/build_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build and Release

on:
push:
tags:
- 'v*'

jobs:
build-and-release:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.12]
os: [windows, linux]
arch: [x86, x64]

steps:
- uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Install Wine for Windows builds
if: matrix.os == 'windows'
run: sudo apt-get install -y wine

- name: Build executables
run: |
for script in BestDnsUpdater.py BestHostsUpdater-IPv4.py BestHostsUpdater.py; do
if [[ "${{ matrix.os }}" == "windows" ]]; then
wine pyinstaller --onefile "$script"
mv "dist/${script%.py}.exe" "dist/${script%.py}-${{ matrix.os }}-${{ matrix.arch }}.exe"
else
pyinstaller --onefile "$script"
mv "dist/${script%.py}" "dist/${script%.py}-${{ matrix.os }}-${{ matrix.arch }}"
fi
done
- name: Zip executables
run: |
zip -j "dist/${{ matrix.os }}-${{ matrix.arch }}-executables.zip" dist/*
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false

- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/*-executables.zip
asset_name: ${{ matrix.os }}-${{ matrix.arch }}-executables.zip
asset_content_type: application/zip
Loading

0 comments on commit c2bd2ad

Please sign in to comment.