From a9d6167a9fe1b76fd9cc7a2ed9f6448883d54777 Mon Sep 17 00:00:00 2001
From: Particle_G <38580644+ParticleG@users.noreply.github.com>
Date: Wed, 28 Sep 2022 15:13:24 +0800
Subject: [PATCH] chore: add support for windows arm64, close #216 (#209)

---
 .github/workflows/alpha.yml | 22 ++++++++++++++++++++++
 .github/workflows/ci.yml    | 22 ++++++++++++++++++++++
 .github/workflows/test.yml  | 17 +++++++++++++++++
 3 files changed, 61 insertions(+)

diff --git a/.github/workflows/alpha.yml b/.github/workflows/alpha.yml
index d0c7780..f6f5cb9 100644
--- a/.github/workflows/alpha.yml
+++ b/.github/workflows/alpha.yml
@@ -42,6 +42,11 @@ jobs:
           sudo apt-get update
           sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libappindicator3-dev librsvg2-dev libayatana-appindicator3-dev
 
+      - name: Install ARM64 toolchain (windows only)
+        if: startsWith(matrix.os, 'windows-')
+        run: |
+          rustup target add aarch64-pc-windows-msvc
+
       - name: Get yarn cache dir path
         id: yarn-cache-dir-path
         run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -76,6 +81,23 @@ jobs:
           releaseDraft: true
           prerelease: true
 
+      - name: Tauri build arm64 (windows only)
+        if: startsWith(matrix.os, 'windows-')
+        uses: tauri-apps/tauri-action@0e558392ccadcb49bcc89e7df15a400e8f0c954d
+        # enable cache even though failed
+        # continue-on-error: true
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
+          TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
+        with:
+          tagName: alpha
+          releaseName: "Clash Verge Alpha"
+          releaseBody: "Alpha Version"
+          releaseDraft: true
+          prerelease: true
+          args: --target aarc64-pc-windows-msvc
+
       # - name: Portable Bundle
       #   if: matrix.os == 'windows-latest'
       #   run: |
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5e98135..d811217 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -42,6 +42,11 @@ jobs:
           sudo apt-get update
           sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libappindicator3-dev librsvg2-dev libayatana-appindicator3-dev
 
+      - name: Install ARM64 toolchain (windows only)
+        if: startsWith(matrix.os, 'windows-')
+        run: |
+          rustup target add aarch64-pc-windows-msvc
+
       - name: Get yarn cache dir path
         id: yarn-cache-dir-path
         run: echo "::set-output name=dir::$(yarn cache dir)"
@@ -75,6 +80,23 @@ jobs:
           releaseDraft: false
           prerelease: true
 
+      - name: Tauri build arm64 (windows only)
+        if: startsWith(matrix.os, 'windows-')
+        uses: tauri-apps/tauri-action@0e558392ccadcb49bcc89e7df15a400e8f0c954d
+        # enable cache even though failed
+        # continue-on-error: true
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
+          TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
+        with:
+          tagName: v__VERSION__
+          releaseName: "Clash Verge v__VERSION__"
+          releaseBody: "More new features are now supported."
+          releaseDraft: false
+          prerelease: true
+          args: --target aarc64-pc-windows-msvc
+      
       - name: Portable Bundle
         if: matrix.os == 'windows-latest'
         # rebuild with env settings
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index fee2df8..cb88a07 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -55,6 +55,11 @@ jobs:
         run: |
           sudo apt-get update
           sudo apt-get install -y libwebkit2gtk-4.0-dev build-essential curl wget libssl-dev libgtk-3-dev libappindicator3-dev librsvg2-dev libayatana-appindicator3-dev
+      
+      - name: Install ARM64 toolchain (windows only)
+        if: startsWith(matrix.os, 'windows-')
+        run: |
+          rustup target add aarch64-pc-windows-msvc
 
       - name: Get yarn cache dir path
         id: yarn-cache-dir-path
@@ -80,3 +85,15 @@ jobs:
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
           TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
           TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
+      
+      - name: Tauri build arm64 (windows only)
+        if: startsWith(matrix.os, 'windows-')
+        uses: tauri-apps/tauri-action@0e558392ccadcb49bcc89e7df15a400e8f0c954d
+        # enable cache even though failed
+        # continue-on-error: true
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
+          TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
+        with:
+          args: --target aarc64-pc-windows-msvc
-- 
GitLab