Skip to content

feat: refactor credential handling to use config for loading and savi… #141

feat: refactor credential handling to use config for loading and savi…

feat: refactor credential handling to use config for loading and savi… #141

Workflow file for this run

name: build
on:
push:
branches: [ "main" ]
tags:
- "v*"
pull_request:
branches: [ "main" ]
jobs:
build:
permissions: write-all
strategy:
matrix:
include:
- os: windows-latest
os_name: windows
arch: amd64
- os: windows-latest
os_name: windows
arch: arm64
- os: macos-latest
os_name: darwin
arch: amd64
target_arch: x86_64
- os: macos-latest
os_name: darwin
arch: arm64
target_arch: arm64
- os: ubuntu-24.04
os_name: linux
arch: amd64
target_arch: x86_64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build Executable (macOS)
if: runner.os == 'macOS'
run: |
mkdir -p core
curl -L "https://github.com/Mythologyli/zju-connect/releases/latest/download/zju-connect-darwin-${{ matrix.arch }}.zip" -o core/zju-connect.zip
unzip core/zju-connect.zip -d core
rm core/zju-connect.zip
pyinstaller --clean --windowed \
--target-arch ${{ matrix.target_arch }} \
--add-data "assets:assets" \
--add-data "utils:utils" \
--add-data "core/zju-connect:core" \
--add-data ".app-version:." \
--icon assets/icon.icns \
-n hitsz-connect-verge main.py
- name: Create DMG (macOS)
if: runner.os == 'macOS'
run: |
brew install create-dmg
create-dmg \
--volname "HITSZ Connect Verge" \
--background "assets/bg.svg" \
--window-pos 400 200 \
--window-size 660 400 \
--icon-size 100 \
--icon "hitsz-connect-verge.app" 160 185 \
--app-drop-link 500 185 \
"dist/hitsz-connect-verge-${{ matrix.os_name }}-${{ matrix.arch }}.dmg" \
"dist/hitsz-connect-verge.app"
- name: Build Executable (Windows)
if: runner.os == 'Windows'
run: |
mkdir -p core
Invoke-WebRequest -Uri "https://github.com/Mythologyli/zju-connect/releases/latest/download/zju-connect-windows-${{ matrix.arch }}.zip" -OutFile "core\zju-connect-windows-${{ matrix.arch }}.zip"
Expand-Archive -Path "core\zju-connect-windows-${{ matrix.arch }}.zip" -DestinationPath "core"
Remove-Item -Path "core\zju-connect-windows-${{ matrix.arch }}.zip"
pyinstaller --clean --noconsole --onefile `
--add-data "assets;assets" `
--add-data "utils;utils" `
--add-data "core\zju-connect.exe;core" `
--add-data ".app-version;." `
--icon assets/icon.ico `
-n hitsz-connect-verge-windows-${{ matrix.arch }} main_fluent.py
- name: Install Linux Dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libglib2.0-0 libgl1 dpkg-dev debhelper
- name: Build Executable (Linux)
if: runner.os == 'Linux'
run: |
mkdir -p core
curl -L "https://github.com/Mythologyli/zju-connect/releases/latest/download/zju-connect-linux-${{ matrix.arch }}.zip" -o core/zju-connect.zip
unzip core/zju-connect.zip -d core
rm core/zju-connect.zip
pyinstaller --noconsole --windowed --clean --onefile \
--target-arch ${{ matrix.target_arch }} \
--add-data "assets:assets" \
--add-data "utils:utils" \
--add-data "core/zju-connect:core" \
--add-data ".app-version:." \
--icon assets/icon.png \
-n hitsz-connect-verge-linux-${{ matrix.arch }} main.py
- name: Archive Executable
uses: actions/upload-artifact@v4
with:
name: hitsz-connect-verge-${{ matrix.os_name }}-${{ matrix.arch }}
path: |
${{ runner.os == 'Windows' && format('dist/hitsz-connect-verge-windows-{0}.exe', matrix.arch) || (runner.os == 'macOS' && format('dist/*.dmg') || format('dist/hitsz-connect-verge-linux-{0}', matrix.arch)) }}
release:
permissions: write-all
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-24.04
steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: hitsz-connect-verge-*
merge-multiple: true
- name: Publish Release
uses: ncipollo/release-action@v1
with:
artifacts: "artifacts/*"
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}