Files

54 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2026-10-21 17:07:42 +08:00
# dp-report
把镜像记录到部署平台:下载并执行平台的 `scripts/push-image` 脚本。
`server` 只填域名,action 会补上 `/api/sdp`,实际执行:
```
curl -fsSL <server>/api/sdp/scripts/push-image | bash -s -- --token <token> --image <registry>/<image> --server <server>/api/sdp
```
## 参数
| 参数 | 必填 | 默认值 | 说明 |
| --- | --- | --- | --- |
| `server` | 否 | `https://auth.coce.cc` | 部署平台地址,只填域名 |
| `token` | 否 | `${{ secrets.DEPLOY_PLATFORM_TOKEN }}` | 部署平台 TOKEN |
| `registry` | 否 | `${{ vars.DOCKER_REGISTRY }}` | 镜像 registry,可替换 |
| `image` | 否 | `${{ github.repository }}` | 镜像名,不含 registry |
最终传给脚本的镜像是 `<registry>/<image>`;如果 `registry` 留空,则直接使用 `image`。`image` 里可以带 tag。
> `token` 默认取 `secrets.DEPLOY_PLATFORM_TOKEN`;如果你的 runner 不支持在 composite action 的 input 默认值里使用 `secrets`,调用时显式传 `token: ${{ secrets.DEPLOY_PLATFORM_TOKEN }}` 即可。
## 示例
```yaml
- uses: actions/dp-report@main
```
替换 registry / image:
```yaml
- uses: actions/dp-report@main
with:
registry: registry.example.com
image: simcu/web
```
替换服务器地址:
```yaml
- uses: actions/dp-report@main
with:
server: https://auth.example.com
```
显式传 token(默认值不可用时):
```yaml
- uses: actions/dp-report@main
with:
token: ${{ secrets.DEPLOY_PLATFORM_TOKEN }}
```