mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 08:45:41 +08:00
603 lines
24 KiB
YAML
603 lines
24 KiB
YAML
name: Auto Build
|
||
|
||
on:
|
||
workflow_dispatch:
|
||
schedule:
|
||
# UTC+8 0,6,12,18
|
||
- cron: "0 16,22,4,10 * * *"
|
||
permissions: write-all
|
||
env:
|
||
TAG_NAME: autobuild
|
||
TAG_CHANNEL: AutoBuild
|
||
CARGO_INCREMENTAL: 0
|
||
RUST_BACKTRACE: short
|
||
concurrency:
|
||
group: "${{ github.workflow }} - ${{ github.head_ref || github.ref }}"
|
||
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
||
|
||
jobs:
|
||
check_commit:
|
||
name: Check Commit Needs Build
|
||
runs-on: ubuntu-latest
|
||
outputs:
|
||
should_run: ${{ steps.check.outputs.should_run }}
|
||
last_tauri_commit: ${{ steps.check.outputs.last_tauri_commit }}
|
||
autobuild_version: ${{ steps.check.outputs.autobuild_version }}
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v4
|
||
with:
|
||
fetch-depth: 2
|
||
|
||
- name: Check if version changed or src changed
|
||
id: check
|
||
run: |
|
||
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
|
||
echo "should_run=true" >> $GITHUB_OUTPUT
|
||
exit 0
|
||
fi
|
||
|
||
CURRENT_VERSION=$(cat package.json | jq -r '.version')
|
||
echo "📦 Current version: $CURRENT_VERSION"
|
||
|
||
git checkout HEAD~1 package.json
|
||
PREVIOUS_VERSION=$(cat package.json | jq -r '.version')
|
||
echo "📦 Previous version: $PREVIOUS_VERSION"
|
||
|
||
git checkout HEAD package.json
|
||
|
||
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
|
||
echo "✅ Version changed from $PREVIOUS_VERSION to $CURRENT_VERSION"
|
||
echo "should_run=true" >> $GITHUB_OUTPUT
|
||
exit 0
|
||
fi
|
||
|
||
# 只检查 src 中的源码文件,排除构建产物和缓存
|
||
CURRENT_SRC_HASH=$(git ls-tree -r HEAD -- src/ ':(exclude)src/dist' ':(exclude)src/build' ':(exclude)src/node_modules' ':(exclude)src/.next' ':(exclude)src/.cache' 2>/dev/null | git hash-object --stdin || echo "")
|
||
PREVIOUS_SRC_HASH=$(git ls-tree -r HEAD~1 -- src/ ':(exclude)src/dist' ':(exclude)src/build' ':(exclude)src/node_modules' ':(exclude)src/.next' ':(exclude)src/.cache' 2>/dev/null | git hash-object --stdin || echo "")
|
||
|
||
# 只检查 src-tauri 中的源码文件,排除构建产物和缓存
|
||
CURRENT_TAURI_HASH=$(git ls-tree -r HEAD -- src-tauri/src src-tauri/Cargo.toml src-tauri/Cargo.lock src-tauri/tauri.*.conf.json src-tauri/build.rs src-tauri/capabilities 2>/dev/null | git hash-object --stdin || echo "")
|
||
PREVIOUS_TAURI_HASH=$(git ls-tree -r HEAD~1 -- src-tauri/src src-tauri/Cargo.toml src-tauri/Cargo.lock src-tauri/tauri.*.conf.json src-tauri/build.rs src-tauri/capabilities 2>/dev/null | git hash-object --stdin || echo "")
|
||
|
||
echo "📂 Current src source hash: $CURRENT_SRC_HASH"
|
||
echo "📂 Previous src source hash: $PREVIOUS_SRC_HASH"
|
||
echo "🦀 Current tauri source hash: $CURRENT_TAURI_HASH"
|
||
echo "🦀 Previous tauri source hash: $PREVIOUS_TAURI_HASH"
|
||
|
||
if [ "$CURRENT_SRC_HASH" != "$PREVIOUS_SRC_HASH" ] || [ "$CURRENT_TAURI_HASH" != "$PREVIOUS_TAURI_HASH" ]; then
|
||
echo "✅ Source directories changed"
|
||
echo "should_run=true" >> $GITHUB_OUTPUT
|
||
exit 0
|
||
fi
|
||
|
||
# Find the last commit that changed Tauri-related files
|
||
echo "🔍 Finding last commit with Tauri-related changes..."
|
||
|
||
# Define patterns for Tauri-related files
|
||
TAURI_PATTERNS="src/ src-tauri/src src-tauri/Cargo.toml src-tauri/Cargo.lock src-tauri/tauri.*.conf.json src-tauri/build.rs src-tauri/capabilities"
|
||
|
||
# Get the last commit that changed any of these patterns (excluding build artifacts)
|
||
LAST_TAURI_COMMIT=""
|
||
for commit in $(git rev-list HEAD --max-count=50); do
|
||
# Check if this commit changed any Tauri-related files
|
||
CHANGED_FILES=$(git show --name-only --pretty=format: $commit | tr '\n' ' ')
|
||
HAS_TAURI_CHANGES=false
|
||
|
||
# Check each pattern
|
||
if echo "$CHANGED_FILES" | grep -q "src/" && echo "$CHANGED_FILES" | grep -qvE "src/(dist|build|node_modules|\.next|\.cache)"; then
|
||
HAS_TAURI_CHANGES=true
|
||
elif echo "$CHANGED_FILES" | grep -qE "src-tauri/(src|Cargo\.(toml|lock)|tauri\..*\.conf\.json|build\.rs|capabilities)"; then
|
||
HAS_TAURI_CHANGES=true
|
||
fi
|
||
|
||
if [ "$HAS_TAURI_CHANGES" = true ]; then
|
||
LAST_TAURI_COMMIT=$(git rev-parse --short $commit)
|
||
break
|
||
fi
|
||
done
|
||
|
||
if [ -z "$LAST_TAURI_COMMIT" ]; then
|
||
echo "⚠️ No Tauri-related changes found in recent commits, using current commit"
|
||
LAST_TAURI_COMMIT=$(git rev-parse --short HEAD)
|
||
fi
|
||
|
||
echo "📝 Last Tauri-related commit: $LAST_TAURI_COMMIT"
|
||
echo "📝 Current commit: $(git rev-parse --short HEAD)"
|
||
|
||
# Generate autobuild version for consistency across jobs
|
||
CURRENT_BASE_VERSION=$(echo "$CURRENT_VERSION" | sed -E 's/-(alpha|beta|rc)(\.[0-9]+)?//g' | sed -E 's/\+[a-zA-Z0-9.-]+//g')
|
||
MONTH=$(date +%m)
|
||
DAY=$(date +%d)
|
||
AUTOBUILD_VERSION="${CURRENT_BASE_VERSION}+autobuild.${MONTH}${DAY}.${LAST_TAURI_COMMIT}"
|
||
|
||
echo "🏷️ Autobuild version: $AUTOBUILD_VERSION"
|
||
echo "📝 Last Tauri commit: $LAST_TAURI_COMMIT"
|
||
|
||
# Set outputs for other jobs to use
|
||
echo "last_tauri_commit=$LAST_TAURI_COMMIT" >> $GITHUB_OUTPUT
|
||
echo "autobuild_version=$AUTOBUILD_VERSION" >> $GITHUB_OUTPUT
|
||
|
||
# Check if autobuild release exists
|
||
echo "🔍 Checking autobuild release and latest.json..."
|
||
AUTOBUILD_RELEASE_EXISTS=$(gh release view "${{ env.TAG_NAME }}" --json id -q '.id' 2>/dev/null || echo "")
|
||
|
||
if [ -z "$AUTOBUILD_RELEASE_EXISTS" ]; then
|
||
echo "✅ No autobuild release exists, build needed"
|
||
echo "should_run=true" >> $GITHUB_OUTPUT
|
||
else
|
||
# Check if latest.json exists in the release
|
||
LATEST_JSON_EXISTS=$(gh release view "${{ env.TAG_NAME }}" --json assets -q '.assets[] | select(.name == "latest.json") | .name' 2>/dev/null || echo "")
|
||
|
||
if [ -z "$LATEST_JSON_EXISTS" ]; then
|
||
echo "✅ No latest.json found in autobuild release, build needed"
|
||
echo "should_run=true" >> $GITHUB_OUTPUT
|
||
else
|
||
# Download and parse latest.json to check version and commit hash
|
||
echo "📥 Downloading latest.json to check version..."
|
||
LATEST_JSON_URL=$(gh release view "${{ env.TAG_NAME }}" --json assets -q '.assets[] | select(.name == "latest.json") | .browser_download_url' 2>/dev/null)
|
||
|
||
if [ -n "$LATEST_JSON_URL" ]; then
|
||
LATEST_JSON_CONTENT=$(curl -s "$LATEST_JSON_URL" 2>/dev/null || echo "")
|
||
|
||
if [ -n "$LATEST_JSON_CONTENT" ]; then
|
||
LATEST_VERSION=$(echo "$LATEST_JSON_CONTENT" | jq -r '.version' 2>/dev/null || echo "")
|
||
echo "📦 Latest autobuild version: $LATEST_VERSION"
|
||
|
||
# Extract commit hash from version string (format: X.Y.Z+autobuild.MMDD.commit)
|
||
LATEST_COMMIT=$(echo "$LATEST_VERSION" | sed -n 's/.*+autobuild\.[0-9]\{4\}\.\([a-f0-9]*\)$/\1/p' || echo "")
|
||
echo "📝 Latest autobuild commit: $LATEST_COMMIT"
|
||
|
||
if [ "$LAST_TAURI_COMMIT" != "$LATEST_COMMIT" ]; then
|
||
echo "✅ Tauri commit hash mismatch ($LAST_TAURI_COMMIT != $LATEST_COMMIT), build needed"
|
||
echo "should_run=true" >> $GITHUB_OUTPUT
|
||
else
|
||
echo "❌ Same Tauri commit hash ($LAST_TAURI_COMMIT), no build needed"
|
||
echo "should_run=false" >> $GITHUB_OUTPUT
|
||
fi
|
||
else
|
||
echo "⚠️ Failed to download or parse latest.json, build needed"
|
||
echo "should_run=true" >> $GITHUB_OUTPUT
|
||
fi
|
||
else
|
||
echo "⚠️ Failed to get latest.json download URL, build needed"
|
||
echo "should_run=true" >> $GITHUB_OUTPUT
|
||
fi
|
||
fi
|
||
fi
|
||
|
||
update_tag:
|
||
name: Update tag
|
||
runs-on: ubuntu-latest
|
||
needs: check_commit
|
||
if: ${{ needs.check_commit.outputs.should_run == 'true' }}
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Fetch UPDATE logs
|
||
id: fetch_update_logs
|
||
run: |
|
||
if [ -f "UPDATELOG.md" ]; then
|
||
UPDATE_LOGS=$(awk '/^## v/{if(flag) exit; flag=1} flag' UPDATELOG.md)
|
||
if [ -n "$UPDATE_LOGS" ]; then
|
||
echo "Found update logs"
|
||
echo "UPDATE_LOGS<<EOF" >> $GITHUB_ENV
|
||
echo "$UPDATE_LOGS" >> $GITHUB_ENV
|
||
echo "EOF" >> $GITHUB_ENV
|
||
else
|
||
echo "No update sections found in UPDATELOG.md"
|
||
fi
|
||
else
|
||
echo "UPDATELOG.md file not found"
|
||
fi
|
||
shell: bash
|
||
|
||
- name: Set Env
|
||
run: |
|
||
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
|
||
shell: bash
|
||
|
||
- run: |
|
||
if [ -z "$UPDATE_LOGS" ]; then
|
||
echo "No update logs found, using default message"
|
||
UPDATE_LOGS="More new features are now supported. Check for detailed changelog soon."
|
||
else
|
||
echo "Using found update logs"
|
||
fi
|
||
|
||
cat > release.txt << EOF
|
||
$UPDATE_LOGS
|
||
|
||
## 我应该下载哪个版本?
|
||
|
||
### MacOS
|
||
- MacOS intel芯片: x64.dmg
|
||
- MacOS apple M芯片: aarch64.dmg
|
||
|
||
### Linux
|
||
- Linux 64位: amd64.deb/amd64.rpm
|
||
- Linux arm64 architecture: arm64.deb/aarch64.rpm
|
||
- Linux armv7架构: armhf.deb/armhfp.rpm
|
||
|
||
### Windows (不再支持Win7)
|
||
#### 正常版本(推荐)
|
||
- 64位: x64-setup.exe
|
||
- arm64架构: arm64-setup.exe
|
||
#### 便携版问题很多不再提供
|
||
#### 内置Webview2版(体积较大,仅在企业版系统或无法安装webview2时使用)
|
||
- 64位: x64_fixed_webview2-setup.exe
|
||
- arm64架构: arm64_fixed_webview2-setup.exe
|
||
|
||
### FAQ
|
||
- [常见问题](https://clash-verge-rev.github.io/faq/windows.html)
|
||
|
||
### 稳定机场VPN推荐
|
||
- [狗狗加速](https://verge.dginv.click/#/register?code=oaxsAGo6)
|
||
|
||
Created at ${{ env.BUILDTIME }}.
|
||
EOF
|
||
|
||
- name: Upload Release
|
||
uses: softprops/action-gh-release@v2
|
||
with:
|
||
tag_name: ${{ env.TAG_NAME }}
|
||
name: "Clash Verge Rev ${{ env.TAG_CHANNEL }}"
|
||
body_path: release.txt
|
||
prerelease: true
|
||
token: ${{ secrets.GITHUB_TOKEN }}
|
||
generate_release_notes: true
|
||
|
||
clean_old_assets:
|
||
name: Clean Old Release Assets
|
||
runs-on: ubuntu-latest
|
||
needs: [check_commit, update_tag]
|
||
if: ${{ needs.check_commit.outputs.should_run == 'true' && needs.update_tag.result == 'success' }}
|
||
steps:
|
||
- name: Checkout repository
|
||
uses: actions/checkout@v4
|
||
- name: Remove old assets from release
|
||
env:
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
TAG_NAME: ${{ env.TAG_NAME }}
|
||
run: |
|
||
# Use consistent values from check_commit job
|
||
CURRENT_AUTOBUILD_VERSION="${{ needs.check_commit.outputs.autobuild_version }}"
|
||
LAST_TAURI_COMMIT="${{ needs.check_commit.outputs.last_tauri_commit }}"
|
||
|
||
echo "📦 Current autobuild version: $CURRENT_AUTOBUILD_VERSION"
|
||
echo "📝 Last Tauri commit: $LAST_TAURI_COMMIT"
|
||
|
||
# Get all assets and remove old ones
|
||
assets=$(gh release view "$TAG_NAME" --json assets -q '.assets[].name' || true)
|
||
for asset in $assets; do
|
||
# Keep assets that match current autobuild version or are non-versioned files (like latest.json)
|
||
if [[ "$asset" == *"$CURRENT_AUTOBUILD_VERSION"* ]] || [[ "$asset" == "latest.json" ]]; then
|
||
echo "🔒 Keeping current asset: $asset"
|
||
else
|
||
echo "🗑️ Deleting old asset: $asset"
|
||
gh release delete-asset "$TAG_NAME" "$asset" -y || echo "⚠️ Failed to delete $asset"
|
||
fi
|
||
done
|
||
|
||
autobuild-x86-windows-macos-linux:
|
||
name: Autobuild x86 Windows, MacOS and Linux
|
||
needs: [check_commit, update_tag]
|
||
if: ${{ needs.check_commit.outputs.should_run == 'true' }}
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
include:
|
||
- os: windows-latest
|
||
target: x86_64-pc-windows-msvc
|
||
- os: windows-latest
|
||
target: aarch64-pc-windows-msvc
|
||
- os: macos-latest
|
||
target: aarch64-apple-darwin
|
||
- os: macos-latest
|
||
target: x86_64-apple-darwin
|
||
- os: ubuntu-22.04
|
||
target: x86_64-unknown-linux-gnu
|
||
runs-on: ${{ matrix.os }}
|
||
steps:
|
||
- name: Checkout Repository
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Install Rust Stable
|
||
uses: dtolnay/rust-toolchain@stable
|
||
|
||
- name: Add Rust Target
|
||
run: rustup target add ${{ matrix.target }}
|
||
|
||
- name: Rust Cache
|
||
uses: Swatinem/rust-cache@v2
|
||
with:
|
||
workspaces: src-tauri
|
||
cache-all-crates: true
|
||
save-if: ${{ github.ref == 'refs/heads/dev' }}
|
||
shared-key: autobuild-shared
|
||
|
||
- name: Install dependencies (ubuntu only)
|
||
if: matrix.os == 'ubuntu-22.04'
|
||
run: |
|
||
sudo apt-get update
|
||
sudo apt-get install -y libxslt1.1 libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf
|
||
|
||
- uses: pnpm/action-setup@v4
|
||
name: Install pnpm
|
||
with:
|
||
run_install: false
|
||
|
||
- name: Install Node
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: "22"
|
||
cache: "pnpm"
|
||
|
||
- name: Pnpm install and check
|
||
run: |
|
||
pnpm i
|
||
pnpm run prebuild ${{ matrix.target }}
|
||
|
||
- name: Release ${{ env.TAG_CHANNEL }} Version
|
||
run: pnpm release-version ${{ env.TAG_NAME }}
|
||
|
||
- name: Tauri build
|
||
uses: tauri-apps/tauri-action@v0
|
||
env:
|
||
NODE_OPTIONS: "--max_old_space_size=4096"
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||
with:
|
||
tagName: ${{ env.TAG_NAME }}
|
||
releaseName: "Clash Verge Rev ${{ env.TAG_CHANNEL }}"
|
||
releaseBody: "More new features are now supported."
|
||
releaseDraft: false
|
||
prerelease: true
|
||
tauriScript: pnpm
|
||
args: --target ${{ matrix.target }}
|
||
|
||
autobuild-arm-linux:
|
||
name: Autobuild ARM Linux
|
||
needs: [check_commit, update_tag]
|
||
if: ${{ needs.check_commit.outputs.should_run == 'true' }}
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
include:
|
||
- os: ubuntu-22.04
|
||
target: aarch64-unknown-linux-gnu
|
||
arch: arm64
|
||
- os: ubuntu-22.04
|
||
target: armv7-unknown-linux-gnueabihf
|
||
arch: armhf
|
||
runs-on: ${{ matrix.os }}
|
||
steps:
|
||
- name: Checkout Repository
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Install Rust Stable
|
||
uses: dtolnay/rust-toolchain@stable
|
||
|
||
- name: Add Rust Target
|
||
run: rustup target add ${{ matrix.target }}
|
||
|
||
- name: Rust Cache
|
||
uses: Swatinem/rust-cache@v2
|
||
with:
|
||
workspaces: src-tauri
|
||
cache-all-crates: true
|
||
save-if: ${{ github.ref == 'refs/heads/dev' }}
|
||
shared-key: autobuild-shared
|
||
|
||
- name: Install pnpm
|
||
uses: pnpm/action-setup@v4
|
||
with:
|
||
run_install: false
|
||
|
||
- name: Install Node
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: "22"
|
||
cache: "pnpm"
|
||
|
||
- name: Pnpm install and check
|
||
run: |
|
||
pnpm i
|
||
pnpm run prebuild ${{ matrix.target }}
|
||
|
||
- name: Release ${{ env.TAG_CHANNEL }} Version
|
||
run: pnpm release-version ${{ env.TAG_NAME }}
|
||
|
||
- name: Setup for linux
|
||
run: |
|
||
sudo ls -lR /etc/apt/
|
||
|
||
cat > /tmp/sources.list << EOF
|
||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy main multiverse universe restricted
|
||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-security main multiverse universe restricted
|
||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-updates main multiverse universe restricted
|
||
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-backports main multiverse universe restricted
|
||
|
||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy main multiverse universe restricted
|
||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-security main multiverse universe restricted
|
||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-updates main multiverse universe restricted
|
||
deb [arch=armhf,arm64] http://ports.ubuntu.com/ubuntu-ports jammy-backports main multiverse universe restricted
|
||
EOF
|
||
|
||
sudo mv /etc/apt/sources.list /etc/apt/sources.list.default
|
||
sudo mv /tmp/sources.list /etc/apt/sources.list
|
||
|
||
sudo dpkg --add-architecture ${{ matrix.arch }}
|
||
sudo apt-get update -y
|
||
sudo apt-get -f install -y
|
||
|
||
sudo apt-get install -y \
|
||
linux-libc-dev:${{ matrix.arch }} \
|
||
libc6-dev:${{ matrix.arch }}
|
||
|
||
sudo apt-get install -y \
|
||
libxslt1.1:${{ matrix.arch }} \
|
||
libwebkit2gtk-4.1-dev:${{ matrix.arch }} \
|
||
libayatana-appindicator3-dev:${{ matrix.arch }} \
|
||
libssl-dev:${{ matrix.arch }} \
|
||
patchelf:${{ matrix.arch }} \
|
||
librsvg2-dev:${{ matrix.arch }}
|
||
|
||
- name: Install aarch64 tools
|
||
if: matrix.target == 'aarch64-unknown-linux-gnu'
|
||
run: |
|
||
sudo apt install -y \
|
||
gcc-aarch64-linux-gnu \
|
||
g++-aarch64-linux-gnu
|
||
|
||
- name: Install armv7 tools
|
||
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
|
||
run: |
|
||
sudo apt install -y \
|
||
gcc-arm-linux-gnueabihf \
|
||
g++-arm-linux-gnueabihf
|
||
|
||
- name: Build for Linux
|
||
run: |
|
||
export PKG_CONFIG_ALLOW_CROSS=1
|
||
if [ "${{ matrix.target }}" == "aarch64-unknown-linux-gnu" ]; then
|
||
export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH
|
||
export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/
|
||
elif [ "${{ matrix.target }}" == "armv7-unknown-linux-gnueabihf" ]; then
|
||
export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig/:$PKG_CONFIG_PATH
|
||
export PKG_CONFIG_SYSROOT_DIR=/usr/arm-linux-gnueabihf/
|
||
fi
|
||
pnpm build --target ${{ matrix.target }}
|
||
env:
|
||
NODE_OPTIONS: "--max_old_space_size=4096"
|
||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||
|
||
- name: Get Version
|
||
run: |
|
||
sudo apt-get update
|
||
sudo apt-get install jq
|
||
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
|
||
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
|
||
|
||
- name: Upload Release
|
||
uses: softprops/action-gh-release@v2
|
||
with:
|
||
tag_name: ${{ env.TAG_NAME }}
|
||
name: "Clash Verge Rev ${{ env.TAG_CHANNEL }}"
|
||
prerelease: true
|
||
token: ${{ secrets.GITHUB_TOKEN }}
|
||
files: |
|
||
src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
|
||
src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
|
||
|
||
autobuild-x86-arm-windows_webview2:
|
||
name: Autobuild x86 and ARM Windows with WebView2
|
||
needs: [check_commit, update_tag]
|
||
if: ${{ needs.check_commit.outputs.should_run == 'true' }}
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
include:
|
||
- os: windows-latest
|
||
target: x86_64-pc-windows-msvc
|
||
arch: x64
|
||
- os: windows-latest
|
||
target: aarch64-pc-windows-msvc
|
||
arch: arm64
|
||
runs-on: ${{ matrix.os }}
|
||
steps:
|
||
- name: Checkout Repository
|
||
uses: actions/checkout@v4
|
||
|
||
- name: Add Rust Target
|
||
run: rustup target add ${{ matrix.target }}
|
||
|
||
- name: Rust Cache
|
||
uses: Swatinem/rust-cache@v2
|
||
with:
|
||
workspaces: src-tauri
|
||
cache-all-crates: true
|
||
save-if: ${{ github.ref == 'refs/heads/dev' }}
|
||
shared-key: autobuild-shared
|
||
|
||
- name: Install pnpm
|
||
uses: pnpm/action-setup@v4
|
||
with:
|
||
run_install: false
|
||
|
||
- name: Install Node
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: "22"
|
||
cache: "pnpm"
|
||
|
||
- name: Pnpm install and check
|
||
run: |
|
||
pnpm i
|
||
pnpm run prebuild ${{ matrix.target }}
|
||
|
||
- name: Release ${{ env.TAG_CHANNEL }} Version
|
||
run: pnpm release-version ${{ env.TAG_NAME }}
|
||
|
||
- name: Download WebView2 Runtime
|
||
run: |
|
||
invoke-webrequest -uri https://github.com/westinyang/WebView2RuntimeArchive/releases/download/109.0.1518.78/Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -outfile Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab
|
||
Expand .\Microsoft.WebView2.FixedVersionRuntime.109.0.1518.78.${{ matrix.arch }}.cab -F:* ./src-tauri
|
||
Remove-Item .\src-tauri\tauri.windows.conf.json
|
||
Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
|
||
|
||
- name: Tauri build
|
||
id: build
|
||
uses: tauri-apps/tauri-action@v0
|
||
env:
|
||
NODE_OPTIONS: "--max_old_space_size=4096"
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
|
||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
|
||
with:
|
||
tauriScript: pnpm
|
||
args: --target ${{ matrix.target }}
|
||
|
||
- name: Rename
|
||
run: |
|
||
$files = Get-ChildItem ".\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\*-setup.exe"
|
||
foreach ($file in $files) {
|
||
$newName = $file.Name -replace "-setup\.exe$", "_fixed_webview2-setup.exe"
|
||
Rename-Item $file.FullName $newName
|
||
}
|
||
|
||
$files = Get-ChildItem ".\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\*.nsis.zip"
|
||
foreach ($file in $files) {
|
||
$newName = $file.Name -replace "-setup\.nsis\.zip$", "_fixed_webview2-setup.nsis.zip"
|
||
Rename-Item $file.FullName $newName
|
||
}
|
||
|
||
$files = Get-ChildItem ".\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\*-setup.exe.sig"
|
||
foreach ($file in $files) {
|
||
$newName = $file.Name -replace "-setup\.exe\.sig$", "_fixed_webview2-setup.exe.sig"
|
||
Rename-Item $file.FullName $newName
|
||
}
|
||
|
||
- name: Upload Release
|
||
uses: softprops/action-gh-release@v2
|
||
with:
|
||
tag_name: ${{ env.TAG_NAME }}
|
||
name: "Clash Verge Rev ${{ env.TAG_CHANNEL }}"
|
||
prerelease: true
|
||
token: ${{ secrets.GITHUB_TOKEN }}
|
||
files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*
|
||
|
||
- name: Portable Bundle
|
||
run: pnpm portable-fixed-webview2 ${{ matrix.target }} --${{ env.TAG_NAME }}
|
||
env:
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|