-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from greenhat616/feat-nightly
feat: nightly build with updater
- Loading branch information
Showing
7 changed files
with
379 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,7 +78,7 @@ jobs: | |
- name: Pnpm install and check | ||
run: | | ||
pnpm i | ||
pnpm check | ||
pnpm check && pnpm prepare:nightly | ||
- name: Tauri build | ||
uses: tauri-apps/tauri-action@v0 | ||
|
@@ -93,7 +93,7 @@ jobs: | |
releaseDraft: false | ||
prerelease: true | ||
tauriScript: pnpm | ||
args: -f default-meta | ||
args: -f default-meta nightly -c ./backend/tauri/tauri.nightly.conf.json | ||
|
||
- name: Portable Bundle (Windows Only) | ||
if: matrix.os == 'windows-latest' | ||
|
@@ -119,5 +119,64 @@ jobs: | |
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | ||
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }} | ||
run: | | ||
pnpm build --target aarch64-apple-darwin | ||
pnpm build:nightly --target aarch64-apple-darwin | ||
pnpm upload:osx-aarch64 | ||
update_tag: | ||
name: Update tag | ||
runs-on: ubuntu-latest | ||
needs: [release] | ||
if: startsWith(github.repository, 'keiko233') | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: dev # Dev branch | ||
- name: Set Env | ||
run: | | ||
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Update Tag | ||
uses: richardsimko/[email protected] | ||
with: | ||
tag_name: pre-release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- run: | | ||
cat > release.txt << 'EOF' | ||
## Clash Nyanpasu Nightly Build | ||
Release created at ${{ env.BUILDTIME }}. | ||
Daily build of Clash Nyanpasu Dev branch. | ||
[See the development log here](https://t.me/keikolog/462) | ||
EOF | ||
- name: Update Release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
name: Clash Nyanpasu Dev | ||
tag: pre-release | ||
bodyFile: release.txt | ||
prerelease: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
updater: | ||
name: Update Nigthly Updater | ||
runs-on: ubuntu-latest | ||
needs: [release, update_tag] | ||
if: startsWith(github.repository, 'keiko233') | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: dev # Dev branch | ||
- uses: pnpm/action-setup@v2 | ||
name: Install pnpm | ||
with: | ||
version: 8 | ||
run_install: false | ||
|
||
- name: Pnpm install | ||
run: pnpm i | ||
- name: Update Updater | ||
run: pnpm updater:nightly | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
{ | ||
"package": { | ||
"productName": "Clash Nyanpasu", | ||
"version": "1.4.2" | ||
}, | ||
"build": { | ||
"distDir": "../../dist", | ||
"devPath": "http://localhost:3000/", | ||
"beforeDevCommand": "pnpm run web:dev", | ||
"beforeBuildCommand": "pnpm run web:build" | ||
}, | ||
"tauri": { | ||
"systemTray": { | ||
"iconPath": "icons/win-tray-icon.png", | ||
"iconAsTemplate": true | ||
}, | ||
"bundle": { | ||
"active": true, | ||
"targets": "all", | ||
"identifier": "moe.elaina.clash.nyanpasu", | ||
"icon": [ | ||
"icons/32x32.png", | ||
"icons/128x128.png", | ||
"icons/[email protected]", | ||
"icons/icon-new.icns", | ||
"icons/icon.ico" | ||
], | ||
"resources": ["resources"], | ||
"externalBin": [ | ||
"sidecar/clash", | ||
"sidecar/mihomo", | ||
"sidecar/mihomo-alpha", | ||
"sidecar/clash-rs" | ||
], | ||
"copyright": "© 2022 zzzgydi All Rights Reserved", | ||
"category": "DeveloperTool", | ||
"shortDescription": "Clash Nyanpasu! (∠・ω< )⌒☆", | ||
"longDescription": "Clash Nyanpasu! (∠・ω< )⌒☆", | ||
"deb": { | ||
"depends": ["openssl"] | ||
}, | ||
"macOS": { | ||
"frameworks": [], | ||
"minimumSystemVersion": "", | ||
"exceptionDomain": "", | ||
"signingIdentity": null, | ||
"entitlements": null | ||
}, | ||
"windows": { | ||
"certificateThumbprint": null, | ||
"digestAlgorithm": "sha256", | ||
"timestampUrl": "", | ||
"wix": { | ||
"language": ["zh-CN", "en-US", "ru-RU"] | ||
} | ||
} | ||
}, | ||
"updater": { | ||
"active": true, | ||
"endpoints": [ | ||
"https://mirror.ghproxy.com/https://github.com/keiko233/clash-nyanpasu/releases/download/updater/update-nightly-proxy.json", | ||
"https://ghproxy.com/https://github.com/keiko233/clash-nyanpasu/releases/download/updater/update-nightly-proxy.json", | ||
"https://github.com/keiko233/clash-nyanpasu/releases/download/updater/update-nightly.json" | ||
], | ||
"dialog": false, | ||
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDlBMUM0NjMxREZCNDRGMjYKUldRbVQ3VGZNVVljbW43N0FlWjA4UkNrbTgxSWxSSXJQcExXNkZjUTlTQkIyYkJzL0tsSWF2d0cK" | ||
}, | ||
"allowlist": { | ||
"shell": { | ||
"all": true | ||
}, | ||
"window": { | ||
"all": true | ||
}, | ||
"process": { | ||
"all": true | ||
}, | ||
"globalShortcut": { | ||
"all": true | ||
}, | ||
"notification": { | ||
"all": true | ||
}, | ||
"os": { | ||
"all": true | ||
} | ||
}, | ||
"windows": [], | ||
"security": { | ||
"csp": "script-src 'unsafe-eval' 'self'; default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self'; img-src data: 'self';" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { execSync } from "child_process"; | ||
import fs from "fs-extra"; | ||
import path from "node:path"; | ||
import { TAURI_APP_DIR, cwd } from "./utils/env"; | ||
import { consola } from "./utils/logger"; | ||
|
||
const TAURI_DEV_APP_CONF_PATH = path.join( | ||
TAURI_APP_DIR, | ||
"tauri.nightly.conf.json", | ||
); | ||
const PACKAGE_JSON_PATH = path.join(cwd, "package.json"); | ||
|
||
async function main() { | ||
const tauriConf = await fs.readJSON(TAURI_DEV_APP_CONF_PATH); | ||
const packageJson = await fs.readJSON(PACKAGE_JSON_PATH); | ||
consola.debug("Get current git short hash"); | ||
const GIT_SHORT_HASH = execSync("git rev-parse --short HEAD") | ||
.toString() | ||
.trim(); | ||
consola.debug(`Current git short hash: ${GIT_SHORT_HASH}`); | ||
|
||
const version = `${tauriConf.package.version}-alpha+${GIT_SHORT_HASH}`; | ||
// 1. update tauri version | ||
consola.debug("Write tauri version to tauri.nightly.conf.json"); | ||
tauriConf.package.version = version; | ||
await fs.writeJSON(TAURI_DEV_APP_CONF_PATH, tauriConf, { spaces: 2 }); | ||
consola.debug("tauri.nightly.conf.json updated"); | ||
// 2. update package version | ||
consola.debug("Write tauri version to package.json"); | ||
packageJson.version = version; | ||
await fs.writeJSON(PACKAGE_JSON_PATH, packageJson, { spaces: 2 }); | ||
consola.debug("package.json updated"); | ||
} | ||
|
||
main(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.