Skip to content

ci: add release workflow (Docker + GitHub Release)#65

Merged
dwgx merged 3 commits intodwgx:masterfrom
abwuge:master
Apr 25, 2026
Merged

ci: add release workflow (Docker + GitHub Release)#65
dwgx merged 3 commits intodwgx:masterfrom
abwuge:master

Conversation

@abwuge
Copy link
Copy Markdown
Contributor

@abwuge abwuge commented Apr 25, 2026

改了什么 / What changed

新增 .github/workflows/release.yml,仅在推送 v* tag 时触发,自动完成两件事:

  1. Docker 镜像构建 & 推送 — 构建 linux/amd64 镜像并推送到 GHCR (ghcr.io)
  2. GitHub Release 创建 — 自动创建 Release 页面,附带 Source code (zip/tar.gz) 下载

同时将 docker-compose.yml 从本地构建 (build:) 改为拉取预构建镜像 (image: ghcr.io/dwgx/windsurf-api:latest),用户无需 clone 代码即可部署。

为什么 / Why

  • 项目缺少 CI/CD 自动发布流程,每次发版需要手动构建 Docker 镜像和创建 Release
  • 用户部署时需要本地 clone 代码再 docker compose build,改为直接 docker pull 更方便

我有强迫症,用了docker 就不想下载源码,作者按需合并吧

测试 / Testing

  • 在 fork 仓库推送 vtest tag 触发 workflow,两个 job 均成功通过
  • Docker 镜像成功推送到 GHCR (ghcr.io/abwuge/windsurf-api:latest)
  • GitHub Release 页面成功创建,release notes 正确读取
  • 测试完成后已清理 vtest tag 和对应 Release

⚠️ 合并后注意 / Post-merge notes

没什么注意的,push 下一个 tag 就自动发布好了

发版流程

git tag v2.0.7
git push origin v2.0.7
  • 仓库中存在 RELEASE_NOTES_2.0.7.md → 自动作为 Release body
  • 不存在 → 自动生成 changelog
  • tag 含 -,例如 -alpha / -beta / -rc → 自动标记为 Pre-release

Checklist

  • 代码风格和现有文件一致 / Code style matches existing files
  • 没有引入 npm 依赖 / No new npm dependencies (project is zero-dep)
  • 涉及 LS binary 协议改动时 在 PR 描述里注明字段号来源 / If touching LS protocol, document field-number source in the PR description
  • 涉及 dashboard UI 用 App.confirm / App.prompt 不用浏览器原生 alert/confirm / Uses App.confirm / App.prompt, not native dialogs (if dashboard)

- Add .github/workflows/release.yml triggered only on v* tags
- Docker job: build amd64 image and push to GHCR (ghcr.io)
- Release job: create GitHub Release with auto release notes
- Update docker-compose.yml to use prebuilt GHCR image
Copilot AI review requested due to automatic review settings April 25, 2026 20:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces an automated release pipeline that publishes a Docker image to GHCR and creates a GitHub Release when a v* tag is pushed, and updates the Compose setup to run from a prebuilt image rather than building locally.

Changes:

  • Add a tag-triggered GitHub Actions workflow to build/push a Docker image to GHCR.
  • Add automated GitHub Release creation with optional RELEASE_NOTES_<version>.md body support.
  • Update docker-compose.yml to pull ghcr.io/...:latest instead of building from the local Dockerfile.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
docker-compose.yml Switch service from local build to pulling a prebuilt GHCR image.
.github/workflows/release.yml New workflow to publish Docker images and create GitHub Releases on v* tag pushes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +67 to +72
release:
name: GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write

Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The release job runs independently of the Docker publish job, so a GitHub Release could be created even if the image build/push fails. To make the release process atomic and match the PR intent (“自动完成两件事”), set the release job to depend on the docker job (e.g., via a needs: docker).

Copilot uses AI. Check for mistakes.
Comment thread docker-compose.yml
build:
context: .
dockerfile: Dockerfile
image: ghcr.io/dwgx/windsurf-api:latest
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coding ghcr.io/dwgx/windsurf-api:latest reduces portability (e.g., repo transfer/rename, self-hosted mirrors) and :latest is not reproducible for deployments. Consider using an overridable image reference via env substitution (with a sensible default) and/or pinning to a version tag in example configs.

Suggested change
image: ghcr.io/dwgx/windsurf-api:latest
image: ${WINDSURF_API_IMAGE:-ghcr.io/dwgx/windsurf-api:1.0.0}

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/release.yml
Prevent pre-release tags (e.g. v2.0.7-rc.1) from overwriting :latest tag
@dwgx
Copy link
Copy Markdown
Owner

dwgx commented Apr 25, 2026

辛苦 @abwuge,模板写得清爽,发版流程也细致到 prerelease 自动判定,这块照单收。

只有一个小细节想跟你对一下,是 docker/metadata-action@v5 处理仓库名大小写的方式 —— 它会 lowercase 但插横杠。从你 fork 上 v2.0.6 跑成功的 workflow log 里能看到:

Docker metadata: images: ghcr.io/abwuge/WindsurfAPI
Docker metadata: ghcr.io/abwuge/windsurfapi:latest   ← 实际推到这里
Build and push:  tags: ghcr.io/abwuge/windsurfapi:2.0.6

镜像落到了 windsurfapi(无横杠),但这次 PR 里 docker-compose.yml 写的是 ghcr.io/dwgx/windsurf-api:latest(带横杠)。merge 之后 docker compose pull 会直接 image-not-found,对端用户会一脸懵。

package.json 的项目名就是 windsurf-api,跟它对齐才符合直觉,所以倾向于改 workflow 那一行:

- name: Docker metadata
  id: meta
  uses: docker/metadata-action@v5
  with:
-   images: ghcr.io/${{ github.repository }}
+   images: ghcr.io/${{ github.repository_owner }}/windsurf-api

另外想顺手把 docker-compose.yml 里的 build: 块保留下来,跟 image: 并排放着 —— 拉镜像的用户照常拉,本地改代码迭代的人也能 docker compose up --build 自构建,两边都不丢。

这两处我接着 merge 你这个 PR 之后直接在 master 顺手补一下,你不用再反工,全部功劳都还是你的。再次感谢 ✨

@dwgx dwgx merged commit 250e6a8 into dwgx:master Apr 25, 2026
2 checks passed
dwgx added a commit that referenced this pull request Apr 25, 2026
…tion

- workflow 推到 `ghcr.io/dwgx/windsurf-api`(之前 `${{ github.repository }}` lowercase
  后是 `windsurfapi` 没有横杠,跟 docker-compose 期望的 `windsurf-api` 不匹配,
  merge 后会直接 image-not-found)
- docker-compose 把 `build:` 块加回去,跟 `image:` 并排:拉镜像的用户照常拉,
  本地开发改代码迭代用 `docker compose up --build` 自构建,两边都不丢

follow-up to #65 / @abwuge
@dwgx
Copy link
Copy Markdown
Owner

dwgx commented Apr 26, 2026

哎呀我去 docker出了一堆问题 不过还是谢谢你的贡献

@abwuge
Copy link
Copy Markdown
Contributor Author

abwuge commented Apr 26, 2026

哎呀我去 docker出了一堆问题 不过还是谢谢你的贡献

是吗,我本地和我的fork都测试过了来着。。。

不过我本地测了好几种方案,这个pr是最后rebase过来的,可能是这里的问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants