Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 100 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Release

on:
push:
tags: ['v*']

jobs:
# ──────────────────────────────────────────────
# Job 1: Build & Push Docker Image (GHCR)
# ──────────────────────────────────────────────
docker:
name: Docker Build & Push
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
# Only tag as latest for stable releases (no pre-release suffix like -rc, -alpha, -beta)
type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }}
# v2.0.6 -> 2.0.6
type=semver,pattern={{version}}
# v2.0.6 -> 2.0
type=semver,pattern={{major}}.{{minor}}
Comment thread
abwuge marked this conversation as resolved.

- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Summary
run: |
echo "## 🐳 Docker Image Published" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Tags:**" >> "$GITHUB_STEP_SUMMARY"
echo '${{ steps.meta.outputs.tags }}' | tr ',' '\n' | sed 's/^/- `/' | sed 's/$/`/' >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "**Platform:** \`linux/amd64\`" >> "$GITHUB_STEP_SUMMARY"

# ──────────────────────────────────────────────
# Job 2: Create GitHub Release with source code
# ──────────────────────────────────────────────
release:
name: GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write

Comment on lines +68 to +73
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.
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Get version from tag
id: version
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"

- name: Check for release notes
id: notes
run: |
NOTES_FILE="RELEASE_NOTES_${{ steps.version.outputs.VERSION }}.md"
if [[ -f "$NOTES_FILE" ]]; then
echo "file=$NOTES_FILE" >> "$GITHUB_OUTPUT"
echo "found=true" >> "$GITHUB_OUTPUT"
else
echo "found=false" >> "$GITHUB_OUTPUT"
fi

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: v${{ steps.version.outputs.VERSION }}
body_path: ${{ steps.notes.outputs.found == 'true' && steps.notes.outputs.file || '' }}
generate_release_notes: ${{ steps.notes.outputs.found != 'true' }}
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
services:
windsurf-api:
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.
# Remove container_name to allow Compose to scale replicas
restart: unless-stopped
init: true
Expand Down
2 changes: 1 addition & 1 deletion nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ http {
# Nginx free version requires manual IP listings for sticky sessions,
# or we rely on ip_hash for generic load balancing if behind a single reverse proxy.
zone windsurf_backend_zone 64k;
server windsurf-api:3003 resolve;
server windsurf-api:3003 resolve;
}

server {
Expand Down
Loading