-
Notifications
You must be signed in to change notification settings - Fork 2
131 lines (107 loc) · 3.36 KB
/
Copy pathrelease.yml
File metadata and controls
131 lines (107 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Release Build
on:
push:
branches:
- main
paths:
- 'Cargo.toml' # 仅监控版本变化
jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
target: [x86_64-unknown-linux-gnu]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build release for Linux
run: |
cargo build --release --target ${{ matrix.target }} --features napcat
env:
CARGO_PROFILE_RELEASE_LTO: true
- name: Upload Linux artifact
uses: actions/upload-artifact@v4
with:
name: agent-cli-linux-${{ matrix.target }}
path: target/${{ matrix.target }}/release/agent-cli
if-no-files-found: error
build-windows:
runs-on: windows-latest
strategy:
matrix:
target: [x86_64-pc-windows-msvc]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build release for Windows
run: |
cargo build --release --target ${{ matrix.target }} --features napcat
env:
CARGO_PROFILE_RELEASE_LTO: true
- name: Upload Windows artifact
uses: actions/upload-artifact@v4
with:
name: agent-cli-windows-${{ matrix.target }}
path: target/${{ matrix.target }}/release/agent-cli.exe
if-no-files-found: error
create-release:
needs: [build-linux, build-windows]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: List downloaded artifacts
run: find artifacts -type f
- name: Create Release
uses: softprops/action-gh-release@v1
if: github.ref == 'refs/heads/main'
with:
files: |
artifacts/**/*
tag_name: v${{ github.run_number }}
name: Release v${{ github.run_number }}
body: |
Automated multi-platform release build triggered by push to main branch.
## Platform Support
### Linux
- **x86_64-unknown-linux-gnu**: `agent-cli-linux-x86_64-unknown-linux-gnu/agent-cli`
### Windows
- **x86_64-pc-windows-msvc**: `agent-cli-windows-x86_64-pc-windows-msvc/agent-cli.exe`
## Usage
### Linux
```bash
chmod +x agent-cli
./agent-cli --help
```
### Windows
```cmd
agent-cli.exe --help
```