From 9e2ae311cd47f7b6fb60e77283955b21c9bbb846 Mon Sep 17 00:00:00 2001 From: keiko233 Date: Sat, 25 Nov 2023 22:49:11 +0800 Subject: [PATCH] chore: test: fix missing env & upload to release --- .github/workflows/macos-aarch64.yaml | 10 +++++--- package.json | 1 - scripts/{aarch.mjs => osx-aarch64-upload.mjs} | 24 ++++++------------- 3 files changed, 14 insertions(+), 21 deletions(-) rename scripts/{aarch.mjs => osx-aarch64-upload.mjs} (83%) diff --git a/.github/workflows/macos-aarch64.yaml b/.github/workflows/macos-aarch64.yaml index a4dcf04b89..3b8abd9d02 100644 --- a/.github/workflows/macos-aarch64.yaml +++ b/.github/workflows/macos-aarch64.yaml @@ -42,8 +42,12 @@ jobs: pnpm i pnpm check --arch arm64 --sidecar-host aarch64-apple-darwin - - name: Tauri build (cmd) + - name: Tauri build with Upload (cmd) + env: + TAG_NAME: dev + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} + TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} run: | pnpm build --target aarch64-apple-darwin - mv ./src-tauri/target/aarch64-apple-darwin/release/bundle/macos/Clash Nyanpasu.app ./src-tauri/target/aarch64-apple-darwin/release/bundle/macos/Clash Nyanpasu.aarch64.app - mv ./src-tauri/target/aarch64-apple-darwin/release/bundle/macos/Clash Nyanpasu.app.tar.gz ./src-tauri/target/aarch64-apple-darwin/release/bundle/macos/Clash Nyanpasu.aarch64.app.tar.gz + node scripts/osx-aarch64-upload.mjs diff --git a/package.json b/package.json index 3f7acb6c1d..7e21737646 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "web:dev": "vite", "web:build": "tsc && vite build", "web:serve": "vite preview", - "aarch": "node scripts/aarch.mjs", "check": "node scripts/check.mjs", "updater": "node scripts/updater.mjs", "publish": "node scripts/publish.mjs", diff --git a/scripts/aarch.mjs b/scripts/osx-aarch64-upload.mjs similarity index 83% rename from scripts/aarch.mjs rename to scripts/osx-aarch64-upload.mjs index f60be2fb0a..4a47c3e446 100644 --- a/scripts/aarch.mjs +++ b/scripts/osx-aarch64-upload.mjs @@ -4,8 +4,6 @@ */ import fs from "fs-extra"; import path from "path"; -import { exit } from "process"; -import { execSync } from "child_process"; import { createRequire } from "module"; import { getOctokit, context } from "@actions/github"; @@ -15,9 +13,6 @@ async function resolve() { if (!process.env.GITHUB_TOKEN) { throw new Error("GITHUB_TOKEN is required"); } - if (!process.env.GITHUB_REPOSITORY) { - throw new Error("GITHUB_REPOSITORY is required"); - } if (!process.env.TAURI_PRIVATE_KEY) { throw new Error("TAURI_PRIVATE_KEY is required"); } @@ -27,15 +22,15 @@ async function resolve() { const { version } = require("../package.json"); - const buildCmd = `pnpm build -f default-meta`; - - console.log(`[INFO]: Upload to tag "${tag}"`); - console.log(`[INFO]: Building app. "${buildCmd}"`); + const tag = process.env.TAG_NAME || `v${version}`; - execSync(buildCmd); + console.log(`[INFO]: Upload to tag ${tag}`); const cwd = process.cwd(); - const bundlePath = path.join(cwd, "src-tauri/target/release/bundle"); + const bundlePath = path.join( + cwd, + "src-tauri/target/aarch64-apple-darwin/release/bundle" + ); const join = (p) => path.join(bundlePath, p); const appPathList = [ @@ -105,9 +100,4 @@ async function uploadAssets(releaseId, assets) { } } -if (process.platform === "darwin" && process.arch === "arm64") { - resolve(); -} else { - console.error("invalid"); - exit(1); -} +resolve();