feat(notify-all): Bark + email 合一 meta-composite,业务侧 1 行 yaml
lint / yamllint (push) Successful in 12s

This commit is contained in:
beforegolive
2026-07-16 08:56:13 +08:00
parent 3f9fa1f9c9
commit 07ef51040a
2 changed files with 171 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
# notify-all
Bark iOS push + SMTP email in **one step**. Designed for zero-config when paired with
**org-level** (or instance-level) secrets on Gitea.
## Usage (极简 / recommended)
```yaml
jobs:
build:
runs-on: ubuntu-latest
steps:
- run: echo "your build steps"
notify:
needs: build
if: always()
runs-on: ubuntu-latest
steps:
- name: notify
uses: http://gitea:3000/gitea_admin/ci-actions/notify-all@v1
with:
status: ${{ needs.build.result }}
```
That's it — Bark 推送 + 邮件发送全自动,body/title/subject 自动从 `github.*` + `inputs.status` 拼,
secret 走 org-levelgitea_admin org 已配)。
## 必传
| Input | 来源 | 说明 |
|---|---|---|
| `status` | caller → `${{ needs.build.result }}` | 唯一必传,用于拼 body / subject |
## 可选 inputs(全部有默认值)
| Input | Default | 说明 |
|---|---|---|
| `title` | `[${{ github.repository }}] ${{ github.workflow }}` | Bark 推送标题 |
| `body` | 自动拼 status / branch / commit / sha / actor / run | 通知正文(Bark + Email 共用) |
| `email_subject` | `[gitea-ci] ${{ github.repository }} - ${{ inputs.status }}` | 邮件主题 |
| `bark_device_key` | `${{ secrets.BARK_DEVICE_KEY }}` | Bark keyorg secret |
| `bark_server` | `https://api.day.app` | Bark server(自建时改) |
| `bark_group` | `gitea-ci` | Bark 分组 |
| `bark_level` | `active` | active / timeSensitive / passive / default |
| `smtp_host` | `smtp.163.com` | SMTP host |
| `smtp_port` | `465` | SMTP SSL 端口 |
| `smtp_user` | `${{ secrets.EMAIL_USER }}` | 发件邮箱(org secret |
| `smtp_pass` | `${{ secrets.EMAIL_SMTP_PASS }}` | SMTP 授权码(org secret |
| `to` | `${{ secrets.EMAIL_TO }}` | 收件邮箱(org secret |
## 依赖的 org-level secretgitea_admin org 已配)
- `BARK_DEVICE_KEY`
- `EMAIL_USER`
- `EMAIL_SMTP_PASS`
- `EMAIL_TO`
业务 repo 不需要再配 secret。
## 内部实现
`notify-all` 是 composite action,内部 chain 调 sibling action
- `uses: ./notify-bark`
- `uses: ./notify-email`
v1.1.0 tag 下三个 action 自包含,runner 拉一次仓库就够。
## 失败处理
Bark / Email 任一失败 → `::warning::` 输出 → step 仍 Success → job 不阻塞。
(继承自 `notify-bark` / `notify-email``curl --retry 2` + `if !` 包裹逻辑。)