Skip to content

Commit

Permalink
chore: configration & rebuild system tray
Browse files Browse the repository at this point in the history
Signed-off-by: 1111mp <[email protected]>
  • Loading branch information
1111mp committed Sep 10, 2024
1 parent 591aba7 commit c731101
Show file tree
Hide file tree
Showing 25 changed files with 1,784 additions and 1,182 deletions.
360 changes: 360 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,360 @@
name: Alpha Build

on: workflow_dispatch
permissions: write-all

env:
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: short

jobs:
alpha:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: windows-latest
target: aarch64-pc-windows-msvc
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-latest
target: x86_64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu

runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable

- name: Add Rust Target
run: rustup target add ${{ matrix.target }}

- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri
cache-all-crates: true

- name: Install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Pnpm install and check
run: |
pnpm i
pnpm check ${{ matrix.target }}
- name: Tauri Build
uses: tauri-apps/tauri-action@v0
env:
NODE_OPTIONS: '--max_old_space_size=4096'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
tagName: v__VERSION__-alpha
releaseName: 'NVM Desktop v__VERSION__-alpha'
releaseBody: 'More new features are now supported.'
releaseDraft: false
prerelease: true
tauriScript: pnpm
args: --target ${{ matrix.target }}

alpha-for-linux-arm64:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Rust Stable
uses: dtolnay/rust-toolchain@stable

- name: Add Rust Target
run: rustup target add ${{ matrix.target }}

- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri
cache-all-crates: true

- name: Install Node
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Pnpm install and check
run: |
pnpm i
pnpm check ${{ matrix.target }}
- name: 'Setup for linux'
run: |-
sudo ls -lR /etc/apt/
echo -------------
# sudo sed 's/mirror+file:\/etc\/apt\/apt-mirrors.txt/[arch-=amd64,i386] http:\/\/ports.ubuntu.com\/ubuntu-ports\//g' /etc/apt/sources.list | sudo tee /etc/apt/sources.list.d/ports.list
# echo -------------
# sudo sed -i 's/mirror+file:\/etc\/apt\/apt-mirrors.txt/[arch=amd64,i386] http:\/\/archive.ubuntu.com\/ubuntu\//g' /etc/apt/sources.list
cat > /tmp/sources.list << EOF
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy main multiverse universe restricted
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-security main multiverse universe restricted
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-updates main multiverse universe restricted
deb [arch=amd64,i386] http://archive.ubuntu.com/ubuntu jammy-backports main multiverse universe restricted
deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy main multiverse universe restricted
deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy-security main multiverse universe restricted
deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy-updates main multiverse universe restricted
deb [arch-=amd64,i386] http://ports.ubuntu.com/ubuntu-ports jammy-backports main multiverse universe restricted
EOF
sudo mv /etc/apt/sources.list /etc/apt/sources.list.default
sudo mv /tmp/sources.list /etc/apt/sources.list
echo -------------
echo /etc/apt/sources.list && cat /etc/apt/sources.list
echo -------------
echo /etc/apt/apt-mirrors.txt && cat /etc/apt/apt-mirrors.txt
echo -------------
echo /etc/apt/sources.list.d/ports.list && cat /etc/apt/sources.list.d/ports.list || true
echo -------------
sudo dpkg --add-architecture arm64
sudo apt update
sudo apt install -y \
gcc-multilib \
g++-multilib
echo -------------
echo install arm64 dependences ...
sudo apt install -y \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
libc6-dev-arm64-cross \
libgtk-3-dev \
patchelf:arm64 \
libwebkit2gtk-4.1-dev:arm64 \
libappindicator3-dev:arm64 \
libssl-dev:arm64 \
libssl3:arm64 \
libgtk-3-dev:arm64 \
librsvg2-dev:arm64
echo 'ok'
- name: Build for Linux
run: |
echo "build native binarys..."
export PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH
export PKG_CONFIG_SYSROOT_DIR=/usr/aarch64-linux-gnu/
export PKG_CONFIG_ALLOW_CROSS=1
pnpm build --target aarch64-unknown-linux-gnu
echo "build native binarys finished"
env:
NODE_OPTIONS: '--max_old_space_size=4096'
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}

- name: Get Version
run: |
sudo apt-get update
sudo apt-get install jq
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
- name: Upload Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{env.VERSION}}-alpha
name: 'NVM Desktop v${{env.VERSION}}-alpha'
body: 'More new features are now supported.'
draft: false
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
files: |
src-tauri/target/${{ matrix.target }}/release/bundle/deb/*.deb
src-tauri/target/${{ matrix.target }}/release/bundle/rpm/*.rpm
alpha-for-fixed-webview2:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
arch: x64
- os: windows-latest
target: aarch64-pc-windows-msvc
arch: arm64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Add Rust Target
run: rustup target add ${{ matrix.target }}

- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
workspaces: src-tauri

- name: Install Node
uses: actions/setup-node@v4
with:
node-version: '20'

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Pnpm install and check
run: |
pnpm i
pnpm check ${{ matrix.target }}
- name: Download WebView2 Runtime
run: |
invoke-webrequest -uri https://github.com/westinyang/WebView2RuntimeArchive/releases/download/127.0.2651.105/Microsoft.WebView2.FixedVersionRuntime.127.0.2651.105.${{ matrix.arch }}.cab -outfile Microsoft.WebView2.FixedVersionRuntime.127.0.2651.105.${{ matrix.arch }}.cab
Expand .\Microsoft.WebView2.FixedVersionRuntime.127.0.2651.105.${{ matrix.arch }}.cab -F:* ./src-tauri
Remove-Item .\src-tauri\tauri.windows.conf.json
Rename-Item .\src-tauri\webview2.${{ matrix.arch }}.json tauri.windows.conf.json
- name: Tauri build
id: build
uses: tauri-apps/tauri-action@v0
env:
NODE_OPTIONS: '--max_old_space_size=4096'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
tauriScript: pnpm
args: --target ${{ matrix.target }}

- name: Rename
run: |
Rename-Item '.\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\NVM Desktop_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}-setup.exe' 'NVM Desktop_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}_fixed_webview2-setup.exe'
Rename-Item '.\src-tauri\target\${{ matrix.target }}\release\bundle\nsis\NVM Desktop_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}-setup.exe.sig' 'NVM Desktop_${{steps.build.outputs.appVersion}}_${{ matrix.arch }}_fixed_webview2-setup.exe.sig'
- name: Upload Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{steps.build.outputs.appVersion}}-alpha
name: 'NVM Desktop v${{steps.build.outputs.appVersion}}-alpha'
body: 'More new features are now supported.'
draft: false
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
files: src-tauri/target/${{ matrix.target }}/release/bundle/nsis/*setup*

update_alpha_notes:
name: Update alpha notes
runs-on: ubuntu-latest
needs: [alpha, alpha-for-linux-arm64, alpha-for-fixed-webview2]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set Env
run: |
echo "BUILDTIME=$(TZ=Asia/Shanghai date)" >> $GITHUB_ENV
shell: bash

- name: Get Version
run: |
sudo apt-get update
sudo apt-get install jq
echo "VERSION=$(cat package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
- name: Update Tag
uses: richardsimko/update-tag@v1
with:
tag_name: v${{ env.VERSION }}-alpha
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- run: |
cat > release.txt << 'EOF'
## Which version should I download?
### MacOS (Prompts that the file is damaged or the developer cannot verify it. Please check [MacOS issues](https://github.com/1111mp/nvm-desktop?tab=readme-ov-file#macos-issues))
- MacOS Intel chip: x64.dmg
- MacOS apple M chip: aarch64.dmg
### Linux
- Linux 64-bit: amd64.deb/amd64.rpm
- Linux arm64 architecture: arm64.deb/aarch64.rpm
### Windows (Win7 users please make sure to install and enable webview2)
#### Normal version (recommended)
- 64-bit: x64-setup.exe
- arm64 architecture: arm64-setup.exe
#### Built-in Webview2 version (large in size, only used when the enterprise version system or Win7 cannot install webview2)
- 64-bit: x64_fixed_webview2-setup.exe
- arm64 architecture: arm64_fixed_webview2-setup.exe
---
## 我应该下载哪个版本?
### MacOS (提示文件损坏或开发者无法验证请查看 [MacOS issues](https://github.com/1111mp/nvm-desktop?tab=readme-ov-file#macos-issues))
- MacOS intel芯片: x64.dmg
- MacOS apple M芯片: aarch64.dmg
### Linux
- Linux 64位: amd64.deb/amd64.rpm
- Linux arm64架构: arm64.deb/aarch64.rpm
### Windows (Win7 用户请确保安装并启用webview2)
#### 正常版本(推荐)
- 64位: x64-setup.exe
- arm64架构: arm64-setup.exe
#### 内置Webview2版(体积较大,仅在企业版系统或Win7无法安装webview2时使用)
- 64位: x64_fixed_webview2-setup.exe
- arm64架构: arm64_fixed_webview2-setup.exe
Created at ${{ env.BUILDTIME }}.
EOF
- name: Upload Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ env.VERSION }}-alpha
name: 'NVM Desktop v${{env.VERSION}}-alpha'
body_path: release.txt
draft: false
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
7 changes: 2 additions & 5 deletions @types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,15 @@ declare global {

interface ConfigrationExport {
color?: string;
mirrors?: string | null;
path: string;
mirrors?: string;
projects?: boolean;
setting?: boolean;
}

interface Configration {
interface ConfigrationImport {
color?: string;
mirrors?: string;
setting?: Setting;
projects?: Project[];
groups?: Group[];
}
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"build:verbose": "tauri build --verbose",
"tauri": "tauri",
"ui:dev": "vite",
"ui:build": "vite build",
"ui:build": "tsc && vite build",
"ui:preview": "vite preview",
"check": "node scripts/check.mjs",
"updater": "node scripts/updater.mjs",
Expand Down Expand Up @@ -84,5 +84,5 @@
"typescript": "^5.5.4",
"vite": "^5.4.2"
},
"packageManager": "pnpm@9.7.0"
}
"packageManager": "pnpm@9.9.0"
}
Loading

0 comments on commit c731101

Please sign in to comment.