Skip to content

Commit eae763a

Browse files
committed
release: v0.1.0
0 parents  commit eae763a

27 files changed

+11282
-0
lines changed

.github/workflows/release.yml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Release version (e.g., v1.0.0)'
11+
required: true
12+
default: 'v0.1.0'
13+
14+
permissions:
15+
contents: write
16+
17+
env:
18+
CARGO_TERM_COLOR: always
19+
20+
jobs:
21+
build:
22+
name: Build on ${{ matrix.os }}
23+
runs-on: ${{ matrix.os }}
24+
strategy:
25+
matrix:
26+
include:
27+
- os: windows-latest
28+
target: x86_64-pc-windows-msvc
29+
artifact_name: netassistant.exe
30+
asset_name: netassistant-windows-x86_64
31+
- os: ubuntu-latest
32+
target: x86_64-unknown-linux-gnu
33+
artifact_name: netassistant
34+
asset_name: netassistant-linux-x86_64
35+
- os: macos-latest
36+
target: x86_64-apple-darwin
37+
artifact_name: netassistant
38+
asset_name: netassistant-macos-x86_64
39+
- os: macos-latest
40+
target: aarch64-apple-darwin
41+
artifact_name: netassistant
42+
asset_name: netassistant-macos-aarch64
43+
44+
steps:
45+
- name: Checkout code
46+
uses: actions/checkout@v4
47+
48+
- name: Setup Rust toolchain
49+
uses: dtolnay/rust-toolchain@stable
50+
with:
51+
targets: ${{ matrix.target }}
52+
53+
- name: Install Rust targets
54+
run: |
55+
rustup target add ${{ matrix.target }}
56+
57+
- name: Cache cargo registry
58+
uses: actions/cache@v4
59+
with:
60+
path: ~/.cargo/registry
61+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
62+
63+
- name: Cache cargo index
64+
uses: actions/cache@v4
65+
with:
66+
path: ~/.cargo/git
67+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
68+
69+
- name: Cache cargo build
70+
uses: actions/cache@v4
71+
with:
72+
path: target
73+
key: ${{ runner.os }}-cargo-build-target-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
74+
75+
- name: Install dependencies (Ubuntu)
76+
if: matrix.os == 'ubuntu-latest'
77+
run: |
78+
sudo apt-get update
79+
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libxkbcommon-x11-dev
80+
81+
- name: Install dependencies (macOS)
82+
if: matrix.os == 'macos-latest'
83+
run: |
84+
brew install openssl
85+
86+
- name: Build release
87+
run: |
88+
cargo build --release --target ${{ matrix.target }}
89+
90+
- name: Prepare artifact (Windows)
91+
if: matrix.os == 'windows-latest'
92+
shell: pwsh
93+
run: |
94+
Copy-Item target\${{ matrix.target }}\release\netassistant.exe netassistant.exe
95+
Compress-Archive -Path netassistant.exe -DestinationPath ${{ matrix.asset_name }}.zip
96+
97+
- name: Prepare artifact (Unix)
98+
if: matrix.os != 'windows-latest'
99+
run: |
100+
strip target/${{ matrix.target }}/release/netassistant || true
101+
tar -czf ${{ matrix.asset_name }}.tar.gz -C target/${{ matrix.target }}/release netassistant
102+
103+
- name: Upload artifact
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: ${{ matrix.asset_name }}
107+
path: ${{ matrix.os == 'windows-latest' && format('{0}.zip', matrix.asset_name) || format('{0}.tar.gz', matrix.asset_name) }}
108+
109+
release:
110+
name: Create Release
111+
needs: build
112+
runs-on: ubuntu-latest
113+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
114+
115+
steps:
116+
- name: Checkout code
117+
uses: actions/checkout@v4
118+
119+
- name: Download all artifacts
120+
uses: actions/download-artifact@v4
121+
with:
122+
path: artifacts
123+
124+
- name: Display structure of downloaded files
125+
run: ls -R artifacts
126+
127+
- name: Get version from tag
128+
id: get_version
129+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
130+
131+
- name: Create Release
132+
uses: softprops/action-gh-release@v1
133+
with:
134+
files: artifacts/*/*
135+
name: Release ${{ steps.get_version.outputs.VERSION }}
136+
body: |
137+
## NetAssistant ${{ steps.get_version.outputs.VERSION }}
138+
139+
### 下载说明
140+
141+
- **Windows**: 下载 `netassistant-windows-x86_64.zip`
142+
- **Linux**: 下载 `netassistant-linux-x86_64.tar.gz`
143+
- **macOS (Intel)**: 下载 `netassistant-macos-x86_64.tar.gz`
144+
- **macOS (Apple Silicon)**: 下载 `netassistant-macos-aarch64.tar.gz`
145+
146+
### 安装方法
147+
148+
#### Windows
149+
1. 下载并解压 `netassistant-windows-x86_64.zip`
150+
2. 运行 `netassistant.exe`
151+
152+
#### Linux
153+
1. 下载并解压 `netassistant-linux-x86_64.tar.gz`
154+
2. 添加执行权限:`chmod +x netassistant`
155+
3. 运行:`./netassistant`
156+
157+
#### macOS
158+
1. 下载对应的 macOS 版本
159+
2. 解压:`tar -xzf netassistant-macos-*.tar.gz`
160+
3. 添加执行权限:`chmod +x netassistant`
161+
4. 运行:`./netassistant`
162+
163+
### 系统要求
164+
165+
- Windows 10 或更高版本
166+
- Linux (需要 GTK3 库)
167+
- macOS 10.15 或更高版本
168+
169+
### 更新内容
170+
171+
请查看 [CHANGELOG.md](https://github.com/sunjary/netassistant/blob/main/CHANGELOG.md) 了解详细更新内容。
172+
draft: false
173+
prerelease: false
174+
env:
175+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/target

0 commit comments

Comments
 (0)