mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
212 lines
5.8 KiB
YAML
212 lines
5.8 KiB
YAML
name: Build
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- v*
|
|
paths-ignore:
|
|
- 'README.md'
|
|
- '.github/ISSUE_TEMPLATE/**'
|
|
- '.github/workflows/issues.yml'
|
|
|
|
permissions: write-all
|
|
|
|
jobs:
|
|
windows:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
arch:
|
|
- x64
|
|
- ia32
|
|
- arm64
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Setup pnpm
|
|
run: npm install -g pnpm
|
|
- name: Install Dependencies
|
|
env:
|
|
npm_config_arch: ${{ matrix.arch }}
|
|
npm_config_target_arch: ${{ matrix.arch }}
|
|
run: |
|
|
pnpm install
|
|
pnpm add @mihomo-party/sysproxy-win32-${{ matrix.arch }}-msvc
|
|
pnpm prepare --${{ matrix.arch }}
|
|
- name: Build
|
|
env:
|
|
npm_config_arch: ${{ matrix.arch }}
|
|
npm_config_target_arch: ${{ matrix.arch }}
|
|
run: pnpm build:win --${{ matrix.arch }}
|
|
- name: Add Portable Flag
|
|
run: |
|
|
New-Item -Path "PORTABLE" -ItemType File
|
|
Get-ChildItem dist/*portable.7z | ForEach-Object {
|
|
7z a $_.FullName PORTABLE
|
|
}
|
|
- name: Generate checksums
|
|
run: pnpm checksum setup.exe portable.7z
|
|
- name: Upload Artifacts
|
|
if: startsWith(github.ref, 'refs/heads/')
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Windows ${{ matrix.arch }}
|
|
path: |
|
|
dist/*.sha256
|
|
dist/*setup.exe
|
|
dist/*portable.7z
|
|
if-no-files-found: error
|
|
- name: Publish Release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
dist/*.sha256
|
|
dist/*setup.exe
|
|
dist/*portable.7z
|
|
body_path: changelog.md
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
linux:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
arch:
|
|
- x64
|
|
- arm64
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Setup pnpm
|
|
run: npm install -g pnpm
|
|
- name: Install Dependencies
|
|
env:
|
|
npm_config_arch: ${{ matrix.arch }}
|
|
npm_config_target_arch: ${{ matrix.arch }}
|
|
run: |
|
|
pnpm install
|
|
pnpm add @mihomo-party/sysproxy-linux-${{ matrix.arch }}-gnu
|
|
sed -i "s/productName: Mihomo Party/productName: mihomo-party/" electron-builder.yml
|
|
pnpm prepare --${{ matrix.arch }}
|
|
- name: Build
|
|
env:
|
|
npm_config_arch: ${{ matrix.arch }}
|
|
npm_config_target_arch: ${{ matrix.arch }}
|
|
run: pnpm build:linux --${{ matrix.arch }}
|
|
- name: Generate checksums
|
|
run: pnpm checksum .deb .rpm
|
|
- name: Upload Artifacts
|
|
if: startsWith(github.ref, 'refs/heads/')
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: Linux ${{ matrix.arch }}
|
|
path: |
|
|
dist/*.sha256
|
|
dist/*.deb
|
|
dist/*.rpm
|
|
if-no-files-found: error
|
|
- name: Publish Release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
dist/*.sha256
|
|
dist/*.deb
|
|
dist/*.rpm
|
|
body_path: changelog.md
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
macos:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
arch:
|
|
- x64
|
|
- arm64
|
|
runs-on: macos-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Setup pnpm
|
|
run: npm install -g pnpm
|
|
- name: Install Dependencies
|
|
env:
|
|
npm_config_arch: ${{ matrix.arch }}
|
|
npm_config_target_arch: ${{ matrix.arch }}
|
|
run: |
|
|
pnpm install
|
|
pnpm add @mihomo-party/sysproxy-darwin-${{ matrix.arch }}
|
|
pnpm prepare --${{ matrix.arch }}
|
|
- name: Build
|
|
env:
|
|
npm_config_arch: ${{ matrix.arch }}
|
|
npm_config_target_arch: ${{ matrix.arch }}
|
|
run: |
|
|
chmod +x build/pkg-scripts/postinstall
|
|
pnpm build:mac --${{ matrix.arch }}
|
|
- name: Generate checksums
|
|
run: pnpm checksum .pkg
|
|
- name: Upload Artifacts
|
|
if: startsWith(github.ref, 'refs/heads/')
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: MacOS ${{ matrix.arch }}
|
|
path: |
|
|
dist/*.sha256
|
|
dist/*.pkg
|
|
if-no-files-found: error
|
|
- name: Publish Release
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: |
|
|
dist/*.sha256
|
|
dist/*.pkg
|
|
body_path: changelog.md
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
artifact:
|
|
if: startsWith(github.ref, 'refs/heads/')
|
|
needs: [windows, linux, macos]
|
|
runs-on: ubuntu-latest
|
|
concurrency:
|
|
group: artifact
|
|
cancel-in-progress: false
|
|
steps:
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: bin/
|
|
merge-multiple: true
|
|
|
|
- name: Upload Prerelease
|
|
uses: softprops/action-gh-release@v1
|
|
if: ${{ success() }}
|
|
with:
|
|
tag_name: pre-release
|
|
files: |
|
|
bin/*
|
|
prerelease: true
|
|
|
|
updater:
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
needs: [windows, macos, linux]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
- name: Setup pnpm
|
|
run: npm install -g pnpm
|
|
- name: Install Dependencies
|
|
run: pnpm install
|
|
- name: Generate latest.yml
|
|
run: pnpm updater
|
|
- name: Publish Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: latest.yml
|
|
body_path: changelog.md
|
|
token: ${{ secrets.GITHUB_TOKEN }} |