Skip to content

Commit f4f33f1

Browse files
committed
workflow: Add Matrix Notification
1 parent d34e3e8 commit f4f33f1

1 file changed

Lines changed: 45 additions & 13 deletions

File tree

.github/workflows/build.yml

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@
22
---
33
name: Build uChill Image
44
on:
5-
# Run on a schedule every UTC Monday & Thursday 23:00
6-
# or JST Tuesday & Friday 8:00
7-
# only run on default branch (main)
5+
# Run on a schedule every UTC Monday & Thursday 23:00
6+
# or JST Tuesday & Friday 8:00
7+
# only run on default branch (main)
88
schedule:
9-
- cron: '0 23 * * MON,THU'
9+
- cron: "0 23 * * MON,THU"
1010

11-
# Run on push of the main and dev branch
11+
# Run on push of the main and dev branch
1212
push:
1313
branches:
1414
- main
1515
- dev
1616
paths:
17-
- 'src/**'
18-
# Partially run on pull_request (only check build)
17+
- "src/**"
18+
# Partially run on pull_request (only check build)
1919
pull_request:
2020
branches:
2121
- main
2222
- dev
2323
paths:
24-
- 'src/**'
25-
# Manual trigger when needed
24+
- "src/**"
25+
# Manual trigger when needed
2626
workflow_dispatch:
2727

2828
concurrency:
@@ -34,7 +34,7 @@ jobs:
3434
runs-on: ubuntu-latest
3535
strategy:
3636
matrix:
37-
nvidia: ['N', 'Y']
37+
nvidia: ["N", "Y"]
3838

3939
permissions:
4040
contents: read
@@ -47,7 +47,7 @@ jobs:
4747
with:
4848
tool-cache: true
4949
docker-images: false
50-
50+
5151
- name: Checkout Code
5252
uses: actions/checkout@v4
5353

@@ -105,8 +105,7 @@ jobs:
105105
tags: ${{ steps.metadata.outputs.tags }}
106106
labels: ${{ steps.metadata.outputs.labels }}
107107
oci: false
108-
build-args:
109-
NVIDIA=${{ env.NVIDIA }}
108+
build-args: NVIDIA=${{ env.NVIDIA }}
110109

111110
# From now, only do on schedule and push
112111
- name: Login to GitHub Container Registry
@@ -146,3 +145,36 @@ jobs:
146145
TAGS: ${{ steps.push.outputs.digest }}
147146
COSIGN_EXPERIMENTAL: false
148147
COSIGN_PRIVATE_KEY: ${{ secrets.SIGNING_SECRET }}
148+
149+
notify_success:
150+
needs: build
151+
if: success()
152+
runs-on: ubuntu-latest
153+
steps:
154+
- name: Send Matrix success notification
155+
uses: fadenb/matrix-chat-message@v0.0.6
156+
with:
157+
homeserver: "matrix.org"
158+
token: ${{ secrets.MATRIX_TOKEN }}
159+
channel: ${{ secrets.MATRIX_CHANNEL }}
160+
message: |
161+
✅ GitHub Action ${{ github.workflow }} completed successfully!
162+
Commit: ${{ github.sha }}
163+
NVidia: ${{ needs.build.outputs.nvidia }}
164+
165+
notify_failure:
166+
needs: build
167+
if: failure()
168+
runs-on: ubuntu-latest
169+
steps:
170+
- name: Send Matrix success notification
171+
uses: fadenb/matrix-chat-message@v0.0.6
172+
with:
173+
homeserver: "matrix.org"
174+
token: ${{ secrets.MATRIX_TOKEN }}
175+
channel: ${{ secrets.MATRIX_CHANNEL }}
176+
message: |
177+
🚨 GitHub Action ${{ github.workflow }} **FAILED**!
178+
Commit: ${{ github.sha }}
179+
NVidia: ${{ needs.build.outputs.nvidia }}
180+
<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View failed run>

0 commit comments

Comments
 (0)