1- name : 🚀 Rustalink Release Pipeline
1+ name : Rustalink Release Pipeline
22
33on :
44 release :
55 types : [published]
6-
76permissions :
87 contents : write
98 packages : write
1817jobs :
1918 # Build Linux Binaries
2019 build-linux :
21- name : 🐧 Build Linux (${{ matrix.arch }})
20+ name : Build Linux (${{ matrix.arch }})
2221 runs-on : ubuntu-22.04
2322
2423 strategy :
@@ -31,29 +30,29 @@ jobs:
3130 arch : arm64
3231
3332 steps :
34- - name : 📥 Checkout source
33+ - name : Checkout source
3534 uses : actions/checkout@v4
3635
37- - name : 🦀 Install Rust
36+ - name : Install Rust
3837 uses : dtolnay/rust-toolchain@stable
3938 with :
4039 targets : ${{ matrix.target }}
4140
42- - name : 📦 Cache cargo registry
41+ - name : Cache cargo registry
4342 uses : actions/cache@v4
4443 with :
4544 path : |
4645 ~/.cargo/registry
4746 ~/.cargo/git
4847 key : ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
4948
50- - name : 🎯 Cache target directory
49+ - name : Cache target directory
5150 uses : actions/cache@v4
5251 with :
5352 path : target
5453 key : ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
5554
56- - name : 🔧 Install build dependencies
55+ - name : Install build dependencies
5756 run : |
5857 sudo apt-get update
5958 sudo apt-get install -y \
@@ -70,23 +69,23 @@ jobs:
7069 echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
7170 fi
7271
73- - name : 🏗 Build release binary
72+ - name : Build release binary
7473 run : cargo build --release --locked --target ${{ matrix.target }}
7574
76- - name : 📦 Rename binary
75+ - name : Rename binary
7776 run : |
7877 mv target/${{ matrix.target }}/release/rustalink \
7978 target/${{ matrix.target }}/release/rustalink-linux-${{ matrix.arch }}
8079
81- - name : 📤 Upload artifact
80+ - name : Upload artifact
8281 uses : actions/upload-artifact@v4
8382 with :
8483 name : rustalink-linux-${{ matrix.arch }}
8584 path : target/${{ matrix.target }}/release/rustalink-linux-${{ matrix.arch }}
8685
8786 # Build macOS + Windows
8887 build-other :
89- name : 💻 Build ${{ matrix.os_name }}
88+ name : Build ${{ matrix.os_name }}
9089 runs-on : ${{ matrix.os }}
9190
9291 strategy :
@@ -114,90 +113,90 @@ jobs:
114113 output : rustalink-windows-arm64.exe
115114
116115 steps :
117- - name : 📥 Checkout source
116+ - name : Checkout source
118117 uses : actions/checkout@v4
119118
120- - name : 🦀 Install Rust
119+ - name : Install Rust
121120 uses : dtolnay/rust-toolchain@stable
122121 with :
123122 targets : ${{ matrix.target }}
124123
125- - name : 📦 Cache cargo registry
124+ - name : Cache cargo registry
126125 uses : actions/cache@v4
127126 with :
128127 path : |
129128 ~/.cargo/registry
130129 ~/.cargo/git
131130 key : ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
132131
133- - name : 🎯 Cache target directory
132+ - name : Cache target directory
134133 uses : actions/cache@v4
135134 with :
136135 path : target
137136 key : ${{ runner.os }}-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
138137
139- - name : 🔧 Install macOS dependencies
138+ - name : Install macOS dependencies
140139 if : startsWith(matrix.os, 'macos')
141140 run : brew install cmake pkg-config
142141
143- - name : 🏗 Build release binary
142+ - name : Build release binary
144143 env :
145144 CMAKE_POLICY_VERSION_MINIMUM : 3.5
146145 run : cargo build --release --locked --target ${{ matrix.target }}
147146
148- - name : 📦 Rename binary (Unix)
147+ - name : Rename binary (Unix)
149148 if : " !startsWith(matrix.os, 'windows')"
150149 run : |
151150 mv target/${{ matrix.target }}/release/rustalink \
152151 target/${{ matrix.target }}/release/${{ matrix.output }}
153152
154- - name : 📦 Rename binary (Windows)
153+ - name : Rename binary (Windows)
155154 if : startsWith(matrix.os, 'windows')
156155 shell : bash
157156 run : |
158157 mv target/${{ matrix.target }}/release/rustalink.exe \
159158 target/${{ matrix.target }}/release/${{ matrix.output }}
160159
161- - name : 📤 Upload artifact
160+ - name : Upload artifact
162161 uses : actions/upload-artifact@v4
163162 with :
164163 name : ${{ matrix.output }}
165164 path : target/${{ matrix.target }}/release/${{ matrix.output }}
166165
167166 # Build & Push Multi-Arch Docker Image
168167 docker :
169- name : 🐳 Build & Push Docker Image
168+ name : Build & Push Docker Image
170169 needs : build-linux
171170 runs-on : ubuntu-latest
172171
173172 steps :
174- - name : 📥 Checkout source
173+ - name : Checkout source
175174 uses : actions/checkout@v4
176175
177- - name : 📥 Download Linux binaries
176+ - name : Download Linux binaries
178177 uses : actions/download-artifact@v4
179178 with :
180179 path : bin
181180 pattern : rustalink-linux-*
182181
183- - name : 📂 Organize binaries
182+ - name : Organize binaries
184183 run : |
185184 mkdir -p bin/linux/amd64 bin/linux/arm64
186185 mv bin/rustalink-linux-amd64/rustalink-linux-amd64 bin/linux/amd64/rustalink
187186 mv bin/rustalink-linux-arm64/rustalink-linux-arm64 bin/linux/arm64/rustalink
188187 chmod +x bin/linux/amd64/rustalink bin/linux/arm64/rustalink
189188
190- - name : 🔧 Setup Docker Buildx
189+ - name : Setup Docker Buildx
191190 uses : docker/setup-buildx-action@v3
192191
193- - name : 🔐 Login to GHCR
192+ - name : Login to GHCR
194193 uses : docker/login-action@v3
195194 with :
196195 registry : ghcr.io
197196 username : ${{ github.actor }}
198197 password : ${{ secrets.GITHUB_TOKEN }}
199198
200- - name : 🏷 Generate Docker metadata
199+ - name : Generate Docker metadata
201200 id : meta
202201 uses : docker/metadata-action@v5
203202 with :
@@ -207,7 +206,7 @@ jobs:
207206 type=semver,pattern={{major}}.{{minor}}
208207 type=raw,value=latest
209208
210- - name : 🚀 Build & Push Image
209+ - name : Build & Push Image
211210 uses : docker/build-push-action@v6
212211 with :
213212 context : .
@@ -223,22 +222,79 @@ jobs:
223222
224223 # Publish GitHub Release Assets
225224 publish :
226- name : 📦 Publish Release Assets
225+ name : Publish Release Assets
227226 needs : [build-linux, build-other]
228227 runs-on : ubuntu-latest
229228
230229 steps :
231- - name : 📥 Download all artifacts
230+ - name : Download all artifacts
232231 uses : actions/download-artifact@v4
233232 with :
234233 path : artifacts
235234 pattern : rustalink-*
236235
237- - name : 🚀 Attach binaries to GitHub Release
236+ - name : Attach binaries to GitHub Release
238237 uses : softprops/action-gh-release@v2
239238 with :
240239 files : artifacts/**/*
241240 fail_on_unmatched_files : false
242241 tag_name : ${{ github.event.release.tag_name }}
243242 overwrite_files : true
244- token : ${{ secrets.GITHUB_TOKEN }}
243+ token : ${{ secrets.GITHUB_TOKEN }}
244+
245+ # Send Discord Notification
246+ notify :
247+ if : always()
248+ name : Discord Notification
249+ needs : [docker, publish]
250+ runs-on : ubuntu-latest
251+ steps :
252+ - name : Generate Discord Payload
253+ run : |
254+ # Safely escape the release body for JSON
255+ BODY_JSON=$(echo "$BODY" | jq -Rs .)
256+ cat <<EOF > discord_payload.json
257+ {
258+ "username": "${{ github.event.repository.name }}",
259+ "avatar_url": "https://github.com/${{ github.repository_owner }}.png",
260+ "embeds": [
261+ {
262+ "author": {
263+ "name": "${{ github.event.repository.name }}",
264+ "url": "https://github.com/${{ github.repository }}",
265+ "icon_url": "https://github.com/${{ github.repository_owner }}.png"
266+ },
267+ "title": "${{ github.event.repository.name }} version ${{ github.event.release.tag_name }} has been released",
268+ "url": "${{ github.event.release.html_url }}",
269+ "description": $BODY_JSON,
270+ "color": 16747520,
271+ "footer": {
272+ "text": "Release by ${{ github.event.release.author.login }}",
273+ "icon_url": "https://github.com/${{ github.event.release.author.login }}.png"
274+ },
275+ "timestamp": "${{ github.event.release.published_at }}"
276+ }
277+ ],
278+ "components": [
279+ {
280+ "type": 1,
281+ "components": [
282+ {
283+ "type": 2,
284+ "style": 5,
285+ "label": "Release Notes",
286+ "url": "${{ github.event.release.html_url }}"
287+ }
288+ ]
289+ }
290+ ]
291+ }
292+ EOF
293+ env :
294+ BODY : ${{ github.event.release.body }}
295+
296+ - name : Send Discord Webhook
297+ uses : tsickert/discord-webhook@v7
298+ with :
299+ webhook-url : ${{ secrets.DISCORD_WEBHOOK_URL }}
300+ raw-data : discord_payload.json
0 commit comments