1+ name : Release
2+
3+ on :
4+ push :
5+ tags :
6+ - ' v*'
7+ workflow_dispatch :
8+ inputs :
9+ tag :
10+ description : ' Tag to release (e.g., v0.3.1)'
11+ required : true
12+
13+ jobs :
14+ build-linux :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - uses : actions/checkout@v4
18+
19+ - name : Install Rust
20+ uses : actions-rs/toolchain@v1
21+ with :
22+ toolchain : stable
23+ override : true
24+
25+ - name : Build for Linux x64
26+ run : |
27+ cargo build --release --target x86_64-unknown-linux-gnu
28+ mv target/x86_64-unknown-linux-gnu/release/apm apm-linux-x64
29+
30+ - name : Upload Linux artifact
31+ uses : actions/upload-artifact@v3
32+ with :
33+ name : apm-linux-x64
34+ path : apm-linux-x64
35+
36+ build-macos :
37+ runs-on : macos-latest
38+ steps :
39+ - uses : actions/checkout@v4
40+
41+ - name : Install Rust
42+ uses : actions-rs/toolchain@v1
43+ with :
44+ toolchain : stable
45+ override : true
46+
47+ - name : Build for macOS x64
48+ run : |
49+ cargo build --release --target x86_64-apple-darwin
50+ mv target/x86_64-apple-darwin/release/apm apm-macos-x64
51+
52+ - name : Build for macOS ARM64
53+ run : |
54+ rustup target add aarch64-apple-darwin
55+ cargo build --release --target aarch64-apple-darwin
56+ mv target/aarch64-apple-darwin/release/apm apm-macos-arm64
57+
58+ - name : Upload macOS x64 artifact
59+ uses : actions/upload-artifact@v3
60+ with :
61+ name : apm-macos-x64
62+ path : apm-macos-x64
63+
64+ - name : Upload macOS ARM64 artifact
65+ uses : actions/upload-artifact@v3
66+ with :
67+ name : apm-macos-arm64
68+ path : apm-macos-arm64
69+
70+ release :
71+ needs : [build-linux, build-macos]
72+ runs-on : ubuntu-latest
73+ permissions :
74+ contents : write
75+ steps :
76+ - uses : actions/checkout@v4
77+
78+ - name : Download artifacts
79+ uses : actions/download-artifact@v3
80+
81+ - name : Create Release
82+ id : create_release
83+ uses : actions/create-release@v1
84+ env :
85+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
86+ with :
87+ tag_name : ${{ github.event.inputs.tag || github.ref_name }}
88+ release_name : APM ${{ github.event.inputs.tag || github.ref_name }}
89+ body : |
90+ Agent Process Manager release
91+
92+ ## Installation
93+
94+ ### Linux x64
95+ ```bash
96+ curl -sSL https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.tag || github.ref_name }}/apm-linux-x64 -o /usr/local/bin/apm
97+ chmod +x /usr/local/bin/apm
98+ ```
99+
100+ ### macOS x64
101+ ```bash
102+ curl -sSL https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.tag || github.ref_name }}/apm-macos-x64 -o /usr/local/bin/apm
103+ chmod +x /usr/local/bin/apm
104+ ```
105+
106+ ### macOS ARM64
107+ ```bash
108+ curl -sSL https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.tag || github.ref_name }}/apm-macos-arm64 -o /usr/local/bin/apm
109+ chmod +x /usr/local/bin/apm
110+ ```
111+ draft : false
112+ prerelease : false
113+
114+ - name : Upload Linux Binary
115+ uses : actions/upload-release-asset@v1
116+ env :
117+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
118+ with :
119+ upload_url : ${{ steps.create_release.outputs.upload_url }}
120+ asset_path : ./apm-linux-x64/apm-linux-x64
121+ asset_name : apm-linux-x64
122+ asset_content_type : application/octet-stream
123+
124+ - name : Upload macOS x64 Binary
125+ uses : actions/upload-release-asset@v1
126+ env :
127+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
128+ with :
129+ upload_url : ${{ steps.create_release.outputs.upload_url }}
130+ asset_path : ./apm-macos-x64/apm-macos-x64
131+ asset_name : apm-macos-x64
132+ asset_content_type : application/octet-stream
133+
134+ - name : Upload macOS ARM64 Binary
135+ uses : actions/upload-release-asset@v1
136+ env :
137+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
138+ with :
139+ upload_url : ${{ steps.create_release.outputs.upload_url }}
140+ asset_path : ./apm-macos-arm64/apm-macos-arm64
141+ asset_name : apm-macos-arm64
142+ asset_content_type : application/octet-stream
0 commit comments