ci: publish artifacts only on version tags

This commit is contained in:
ShukeBta
2026-05-29 00:32:13 +08:00
parent fef90aea5d
commit 32d7fb0f45
4 changed files with 49 additions and 9 deletions
+1 -5
View File
@@ -2,9 +2,7 @@ name: Publish Docker image
on:
push:
branches: [main]
tags: ['v*', 'MediaStationGo-v*']
workflow_dispatch:
permissions:
contents: read
@@ -32,10 +30,8 @@ jobs:
with:
images: ghcr.io/shukebta/mediastation-go
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=branch
type=raw,value=latest
type=ref,event=tag
type=sha,prefix=
- name: Build & push
uses: docker/build-push-action@v6
-1
View File
@@ -3,7 +3,6 @@ name: Publish release packages
on:
push:
tags: ['v*', 'MediaStationGo-v*']
workflow_dispatch:
permissions:
contents: write
+44 -1
View File
@@ -170,7 +170,7 @@ MediaStationGo 采用完全开源路线,核心媒体库、刮削、播放、
| 下载联动 | qBittorrent / PT Site Adapter | 站点搜索、订阅、下载任务展示与脱敏 |
| 外部兼容 | Emby-style API / DLNA | 面向外部播放器与三端客户端 |
| 部署 | Docker / Docker Compose / Shell / PowerShell | NAS、Linux、Windows 均可部署 |
| CI/CD | GitHub Actions / GHCR | 多架构镜像与 Release 包自动发布 |
| CI/CD | GitHub Actions / GHCR | 仅版本标签触发多架构镜像与 Release 包发布 |
---
@@ -632,6 +632,49 @@ HTTP Header: x-api-key
---
## 🧪 构建、打包与发布
### Docker 镜像
默认镜像:
```text
ghcr.io/shukebta/mediastation-go:latest
ghcr.io/shukebta/mediastation-go:MediaStationGo-v0.0.4
```
> GitHub Actions 仅在推送 `v*` 或 `MediaStationGo-v*` 版本标签时发布 Docker 镜像,不会因 README、截图、文档或普通 `main` 分支提交重复打包。自动发布只生成 `latest` 与版本标签,不再发布 `main` 或短 SHA 标签。
Linux/macOS 推送:
```bash
docker login ghcr.io
IMAGE=ghcr.io/shukebta/mediastation-go TAG=MediaStationGo-v0.0.4 ./scripts/docker-build-push.sh
```
Windows 推送:
```powershell
docker login ghcr.io
.\scripts\docker-build-push.ps1 -Image ghcr.io/shukebta/mediastation-go -Tag MediaStationGo-v0.0.4
```
仅本地构建:
```powershell
.\scripts\docker-build-push.ps1 -Tag dev -Load
```
### Release 包
```bash
VERSION=MediaStationGo-v0.0.4 ./scripts/package-release.sh
```
GitHub Actions 会在推送 `v*` 或 `MediaStationGo-v*` 版本标签时自动生成 Release 包和 SHA256 校验文件;普通代码或文档提交不会创建 Release 包。
> 如果 Release 开启 immutable,不应覆盖同名资产;工作流已设置 `overwrite_files: false`,避免重跑时删除旧资产失败。
---
## 🔐 隐私与安全
+4 -2
View File
@@ -170,7 +170,7 @@ The current base license is `GPL-3.0`, and contributions are welcome under that
| Downloads | qBittorrent / PT site adapters | Search, subscriptions, task cards, private URL redaction |
| Compatibility | Emby-style API / DLNA | External clients and player integrations |
| Deployment | Docker / Docker Compose / Shell / PowerShell | NAS, Linux, Windows, and macOS friendly |
| CI/CD | GitHub Actions / GHCR | Multi-arch Docker images and release packages |
| CI/CD | GitHub Actions / GHCR | Multi-arch Docker images and release packages only on version tags |
---
@@ -640,6 +640,8 @@ ghcr.io/shukebta/mediastation-go:latest
ghcr.io/shukebta/mediastation-go:MediaStationGo-v0.0.4
```
> GitHub Actions publishes Docker images only when a `v*` or `MediaStationGo-v*` version tag is pushed. README, screenshot, documentation, and normal `main` branch commits do not trigger image packaging. Automated publishing now emits only `latest` and the version tag, not `main` or short SHA tags.
Linux/macOS push:
```bash
@@ -666,7 +668,7 @@ Local build only:
VERSION=MediaStationGo-v0.0.4 ./scripts/package-release.sh
```
GitHub Actions automatically builds release packages and SHA256 checksums when a `MediaStationGo-v*` tag is pushed.
GitHub Actions automatically builds release packages and SHA256 checksums when a `v*` or `MediaStationGo-v*` version tag is pushed. Normal code or documentation commits do not create release packages.
> If immutable releases are enabled, same-name assets should not be overwritten. The workflow uses `overwrite_files: false` to avoid deleting immutable assets on reruns.