chore: aarch script

This commit is contained in:
GyDi 2023-02-01 21:41:15 +08:00
parent b79456e91b
commit 2643e853af
No known key found for this signature in database
GPG Key ID: 9C3AD40F1F99880A

View File

@ -1,12 +1,19 @@
/**
* Build and upload assets for macOS(aarch)
* Build and upload assets
* for macOS(aarch)
*/
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";
// to `meta` tag
const META = process.argv.includes("--meta");
// to `alpha` tag
const ALPHA = process.argv.includes("--alpha");
const require = createRequire(import.meta.url);
async function resolve() {
@ -25,6 +32,14 @@ async function resolve() {
const { version } = require("../package.json");
const tag = META ? "meta" : ALPHA ? "alpha" : `v${version}`;
const buildCmd = META ? `yarn build -f default-meta` : `yarn build`;
console.log(`[INFO]: Upload to tag "${tag}"`);
console.log(`[INFO]: Building app. "${buildCmd}"`);
execSync(buildCmd);
const cwd = process.cwd();
const bundlePath = path.join(cwd, "src-tauri/target/release/bundle");
const join = (p) => path.join(bundlePath, p);
@ -48,7 +63,7 @@ async function resolve() {
const { data: release } = await github.rest.repos.getReleaseByTag({
...options,
tag: `v${version}`,
tag,
});
if (!release.id) throw new Error("failed to find the release");