84 lines
2.7 KiB
Markdown
84 lines
2.7 KiB
Markdown
# 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-level(gitea_admin org 已配)。
|
||
|
||
## 必传
|
||
|
||
| Input | 来源 | 说明 |
|
||
|---|---|---|
|
||
| `status` | caller → `${{ needs.build.result }}` | 唯一必传,用于拼 body / subject |
|
||
|
||
## 可选 inputs(全部有默认值)
|
||
|
||
| Input | Default | 说明 |
|
||
|---|---|---|
|
||
| `title` | `[${{ github.repository }}] ${{ github.workflow }}` | Bark 推送标题 |
|
||
| `email_subject` | `[gitea-ci] ${{ github.repository }} - ${{ inputs.status }}` | 邮件主题 |
|
||
| `bark_device_key` | `${{ secrets.BARK_DEVICE_KEY }}` | Bark key(org 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) |
|
||
|
||
> body 不再是 input(v1.1.2 起),由 notify-all 自动拼(status / branch / commit / **sha 前 10 位** / actor / run)。如需自定义 body,绕开 notify-all 直接用 notify-bark + notify-email。
|
||
|
||
## 自动拼的 body 格式
|
||
|
||
```
|
||
status: success
|
||
branch: main
|
||
commit: ci: any commit message
|
||
sha: 29a4454e0 # ← 只取前 10 位
|
||
actor: gitea_admin
|
||
run: http://gitea:3000/gitea_admin/<repo>/actions/runs/<id>
|
||
```
|
||
|
||
## 依赖的 org-level secret(gitea_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 !` 包裹逻辑。) |