mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-04 20:27:33 +08:00
workflow: remove 32-bit platform (#2855)
* chore: build portable by self * chore: remove 32bit platform * Update CONTRIBUTING.md * update alpha version
This commit is contained in:
parent
97d683541d
commit
9bb2160abe
8
.github/workflows/alpha.yml
vendored
8
.github/workflows/alpha.yml
vendored
@ -92,12 +92,6 @@ jobs:
|
|||||||
tauriScript: pnpm
|
tauriScript: pnpm
|
||||||
args: --target ${{ matrix.target }}
|
args: --target ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Portable Bundle
|
|
||||||
if: matrix.os == 'windows-latest'
|
|
||||||
run: pnpm portable ${{ matrix.target }} --alpha
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
alpha-for-linux-arm:
|
alpha-for-linux-arm:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@ -347,7 +341,7 @@ jobs:
|
|||||||
- Linux arm64 architecture: arm64.deb/aarch64.rpm
|
- Linux arm64 architecture: arm64.deb/aarch64.rpm
|
||||||
- Linux armv7架构: armhf.deb/armhfp.rpm
|
- Linux armv7架构: armhf.deb/armhfp.rpm
|
||||||
|
|
||||||
### Windows (Win7 用户请查看下面FAQ中的解决方案)
|
### Windows (不再支持Win7)
|
||||||
#### 正常版本(推荐)
|
#### 正常版本(推荐)
|
||||||
- 64位: x64-setup.exe
|
- 64位: x64-setup.exe
|
||||||
- arm64架构: arm64-setup.exe
|
- arm64架构: arm64-setup.exe
|
||||||
|
9
.github/workflows/release.yml
vendored
9
.github/workflows/release.yml
vendored
@ -87,12 +87,6 @@ jobs:
|
|||||||
tauriScript: pnpm
|
tauriScript: pnpm
|
||||||
args: --target ${{ matrix.target }}
|
args: --target ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Portable Bundle
|
|
||||||
if: matrix.os == 'windows-latest'
|
|
||||||
run: pnpm portable ${{ matrix.target }}
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
release-for-linux-arm:
|
release-for-linux-arm:
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@ -221,9 +215,6 @@ jobs:
|
|||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
target: x86_64-pc-windows-msvc
|
target: x86_64-pc-windows-msvc
|
||||||
arch: x64
|
arch: x64
|
||||||
- os: windows-latest
|
|
||||||
target: i686-pc-windows-msvc
|
|
||||||
arch: x86
|
|
||||||
- os: windows-latest
|
- os: windows-latest
|
||||||
target: aarch64-pc-windows-msvc
|
target: aarch64-pc-windows-msvc
|
||||||
arch: arm64
|
arch: arm64
|
||||||
|
@ -38,7 +38,7 @@ npm install pnpm -g
|
|||||||
pnpm install
|
pnpm install
|
||||||
```
|
```
|
||||||
|
|
||||||
### Download the Clash Mihomo Core Binary
|
### Download the Mihomo Core Binary
|
||||||
|
|
||||||
You have two options for downloading the clash binary:
|
You have two options for downloading the clash binary:
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ You have two options for downloading the clash binary:
|
|||||||
# Use '--force' to force update to the latest version
|
# Use '--force' to force update to the latest version
|
||||||
# pnpm run check --force
|
# pnpm run check --force
|
||||||
```
|
```
|
||||||
- Manually download it from the [Clash Meta release](https://github.com/MetaCubeX/Clash.Meta/releases). After downloading, rename the binary according to the [Tauri configuration](https://tauri.app/v1/api/config#bundleconfig.externalbin).
|
- Manually download it from the [Mihomo release](https://github.com/MetaCubeX/mihomo/releases). After downloading, rename the binary according to the [Tauri configuration](https://tauri.app/v1/api/config#bundleconfig.externalbin).
|
||||||
|
|
||||||
### Run the Development Server
|
### Run the Development Server
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ pnpm dev:diff
|
|||||||
To build this project:
|
To build this project:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pnpm run build
|
pnpm build
|
||||||
```
|
```
|
||||||
|
|
||||||
For a faster build, use the following command
|
For a faster build, use the following command
|
||||||
@ -86,6 +86,14 @@ To clean rust build:
|
|||||||
pnpm clean
|
pnpm clean
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Portable Version (Windows Only)
|
||||||
|
|
||||||
|
To package portable version after the build:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
pnpm portable
|
||||||
|
```
|
||||||
|
|
||||||
## Contributing Your Changes
|
## Contributing Your Changes
|
||||||
|
|
||||||
Once you have made your changes:
|
Once you have made your changes:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "clash-verge",
|
"name": "clash-verge",
|
||||||
"version": "2.1.3",
|
"version": "2.1.3-alpha",
|
||||||
"license": "GPL-3.0-only",
|
"license": "GPL-3.0-only",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "cross-env RUST_BACKTRACE=1 tauri dev -f verge-dev -- --profile fast-dev",
|
"dev": "cross-env RUST_BACKTRACE=1 tauri dev -f verge-dev -- --profile fast-dev",
|
||||||
|
@ -26,29 +26,41 @@ async function getLatestCommitHash() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string 传入格式化后的hash
|
* @param string 传入格式化后的hash
|
||||||
* 将新的版本号写入文件 package.json
|
* 将新的版本号写入文件 package.json / tauri.conf.json
|
||||||
*/
|
*/
|
||||||
async function updatePackageVersion(newVersion) {
|
async function updatePackageVersion(newVersion) {
|
||||||
// 获取内容根目录
|
// 获取内容根目录
|
||||||
const _dirname = process.cwd();
|
const _dirname = process.cwd();
|
||||||
const packageJsonPath = path.join(_dirname, "package.json");
|
const packageJsonPath = path.join(_dirname, "package.json");
|
||||||
|
const tauriDir = path.join(_dirname, "src-tauri");
|
||||||
|
const internalfile = path.join(tauriDir, "tauri.conf.json");
|
||||||
try {
|
try {
|
||||||
const data = await fs.readFile(packageJsonPath, "utf8");
|
const data = await fs.readFile(packageJsonPath, "utf8");
|
||||||
|
const tauriData = await fs.readFile(internalfile, "utf8");
|
||||||
|
|
||||||
const packageJson = JSON.parse(data);
|
const packageJson = JSON.parse(data);
|
||||||
const initversion = packageJson.version;
|
const tauriJson = JSON.parse(tauriData);
|
||||||
// 将匹配到的第一个 "alpha" => 具体的hash
|
|
||||||
const fixversion = initversion.replace("alpha", newVersion);
|
let result = packageJson.version.replace("alpha", newVersion);
|
||||||
packageJson.version = fixversion;
|
console.log("[INFO]: Current version is: ", result);
|
||||||
|
packageJson.version = result;
|
||||||
|
tauriJson.version = result;
|
||||||
// 写入版本号
|
// 写入版本号
|
||||||
await fs.writeFile(
|
await fs.writeFile(
|
||||||
packageJsonPath,
|
packageJsonPath,
|
||||||
JSON.stringify(packageJson, null, 2),
|
JSON.stringify(packageJson, null, 2),
|
||||||
"utf8",
|
"utf8",
|
||||||
);
|
);
|
||||||
console.log(`Alpha version update to: ${fixversion}`);
|
await fs.writeFile(
|
||||||
|
internalfile,
|
||||||
|
JSON.stringify(tauriJson, null, 2),
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
console.log(`[INFO]: Alpha version update to: ${newVersion}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("pnpm run fix-alpha-version ERROR", error);
|
console.error("pnpm run fix-alpha-version ERROR", error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const newVersion = await getLatestCommitHash();
|
const newVersion = await getLatestCommitHash();
|
||||||
updatePackageVersion(newVersion);
|
updatePackageVersion(newVersion).catch(console.error);
|
||||||
|
@ -2,20 +2,16 @@ import fs from "fs";
|
|||||||
import path from "path";
|
import path from "path";
|
||||||
import AdmZip from "adm-zip";
|
import AdmZip from "adm-zip";
|
||||||
import { createRequire } from "module";
|
import { createRequire } from "module";
|
||||||
import { getOctokit, context } from "@actions/github";
|
import fsp from "fs/promises";
|
||||||
|
|
||||||
const target = process.argv.slice(2)[0];
|
const target = process.argv.slice(2)[0];
|
||||||
const alpha = process.argv.slice(2)[1];
|
|
||||||
|
|
||||||
const ARCH_MAP = {
|
const ARCH_MAP = {
|
||||||
"x86_64-pc-windows-msvc": "x64",
|
"x86_64-pc-windows-msvc": "x64",
|
||||||
"i686-pc-windows-msvc": "x86",
|
|
||||||
"aarch64-pc-windows-msvc": "arm64",
|
"aarch64-pc-windows-msvc": "arm64",
|
||||||
};
|
};
|
||||||
|
|
||||||
const PROCESS_MAP = {
|
const PROCESS_MAP = {
|
||||||
x64: "x64",
|
x64: "x64",
|
||||||
ia32: "x86",
|
|
||||||
arm64: "arm64",
|
arm64: "arm64",
|
||||||
};
|
};
|
||||||
const arch = target ? ARCH_MAP[target] : PROCESS_MAP[process.arch];
|
const arch = target ? ARCH_MAP[target] : PROCESS_MAP[process.arch];
|
||||||
@ -37,10 +33,9 @@ async function resolvePortable() {
|
|||||||
if (!fs.existsSync(path.join(configDir, "PORTABLE"))) {
|
if (!fs.existsSync(path.join(configDir, "PORTABLE"))) {
|
||||||
await fsp.writeFile(path.join(configDir, "PORTABLE"), "");
|
await fsp.writeFile(path.join(configDir, "PORTABLE"), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
const zip = new AdmZip();
|
const zip = new AdmZip();
|
||||||
|
|
||||||
zip.addLocalFile(path.join(releaseDir, "Clash Verge.exe"));
|
zip.addLocalFile(path.join(releaseDir, "clash-verge.exe"));
|
||||||
zip.addLocalFile(path.join(releaseDir, "verge-mihomo.exe"));
|
zip.addLocalFile(path.join(releaseDir, "verge-mihomo.exe"));
|
||||||
zip.addLocalFile(path.join(releaseDir, "verge-mihomo-alpha.exe"));
|
zip.addLocalFile(path.join(releaseDir, "verge-mihomo-alpha.exe"));
|
||||||
zip.addLocalFolder(path.join(releaseDir, "resources"), "resources");
|
zip.addLocalFolder(path.join(releaseDir, "resources"), "resources");
|
||||||
@ -49,46 +44,9 @@ async function resolvePortable() {
|
|||||||
const require = createRequire(import.meta.url);
|
const require = createRequire(import.meta.url);
|
||||||
const packageJson = require("../package.json");
|
const packageJson = require("../package.json");
|
||||||
const { version } = packageJson;
|
const { version } = packageJson;
|
||||||
|
|
||||||
const zipFile = `Clash.Verge_${version}_${arch}_portable.zip`;
|
const zipFile = `Clash.Verge_${version}_${arch}_portable.zip`;
|
||||||
zip.writeZip(zipFile);
|
zip.writeZip(zipFile);
|
||||||
|
|
||||||
console.log("[INFO]: create portable zip successfully");
|
console.log("[INFO]: create portable zip successfully");
|
||||||
|
|
||||||
// push release assets
|
|
||||||
if (process.env.GITHUB_TOKEN === undefined) {
|
|
||||||
throw new Error("GITHUB_TOKEN is required");
|
|
||||||
}
|
|
||||||
|
|
||||||
const options = { owner: context.repo.owner, repo: context.repo.repo };
|
|
||||||
const github = getOctokit(process.env.GITHUB_TOKEN);
|
|
||||||
const tag = alpha ? "alpha" : process.env.TAG_NAME || `v${version}`;
|
|
||||||
console.log("[INFO]: upload to ", tag);
|
|
||||||
|
|
||||||
const { data: release } = await github.rest.repos.getReleaseByTag({
|
|
||||||
...options,
|
|
||||||
tag,
|
|
||||||
});
|
|
||||||
|
|
||||||
let assets = release.assets.filter((x) => {
|
|
||||||
return x.name === zipFile;
|
|
||||||
});
|
|
||||||
if (assets.length > 0) {
|
|
||||||
let id = assets[0].id;
|
|
||||||
await github.rest.repos.deleteReleaseAsset({
|
|
||||||
...options,
|
|
||||||
asset_id: id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(release.name);
|
|
||||||
|
|
||||||
await github.rest.repos.uploadReleaseAsset({
|
|
||||||
...options,
|
|
||||||
release_id: release.id,
|
|
||||||
name: zipFile,
|
|
||||||
data: zip.toBuffer(),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resolvePortable().catch(console.error);
|
resolvePortable().catch(console.error);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"version": "2.1.3",
|
"version": "2.1.3-alpha",
|
||||||
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
|
||||||
"bundle": {
|
"bundle": {
|
||||||
"active": true,
|
"active": true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user