diff --git a/.github/workflows/notarize-macos.yml b/.github/workflows/notarize-macos.yml index 4d883d61..25f7ac1b 100644 --- a/.github/workflows/notarize-macos.yml +++ b/.github/workflows/notarize-macos.yml @@ -154,7 +154,7 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} R2_ENDPOINTS: ${{ secrets.R2_ENDPOINTS }} - R2_BUCKET: ${{ secrets.R2_BUCKET || 'get-yaoapps' }} + R2_BUCKET: ${{ secrets.R2_BUCKET || 'releases' }} steps: - name: Checkout (for gh CLI context) uses: actions/checkout@v4 @@ -169,7 +169,7 @@ jobs: - name: Verify all platform assets on R2 run: | VERSION="${{ needs.resolve.outputs.version }}" - PREFIX="releases/yao/${VERSION}" + PREFIX="yao/${VERSION}" PLATFORMS=( "darwin-arm64" diff --git a/.github/workflows/release-linux.yml b/.github/workflows/release-linux.yml index 009aa303..9039ed20 100644 --- a/.github/workflows/release-linux.yml +++ b/.github/workflows/release-linux.yml @@ -86,6 +86,27 @@ jobs: echo "version=${VERSION}" >> $GITHUB_OUTPUT echo "VERSION=${VERSION}" + - name: Download Linux Artifacts + uses: actions/download-artifact@v4 + with: + name: yao-linux + path: artifacts + + - name: Prepare Docker Contexts + run: | + VERSION="${{ steps.version.outputs.version }}" + ls -la artifacts/ + + # Development image uses dev (unstripped) binaries + cp "artifacts/yao-${VERSION}-linux-amd64" docker/development/yao-amd64 + cp "artifacts/yao-${VERSION}-linux-arm64" docker/development/yao-arm64 + chmod +x docker/development/yao-* + + # Production image uses prod (stripped) binaries + cp "artifacts/yao-${VERSION}-linux-amd64-prod" docker/production/yao-amd64 + cp "artifacts/yao-${VERSION}-linux-arm64-prod" docker/production/yao-arm64 + chmod +x docker/production/yao-* + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -103,8 +124,6 @@ jobs: with: context: ./docker/development platforms: linux/amd64,linux/arm64 - build-args: | - VERSION=${{ steps.version.outputs.version }} push: true tags: | ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }}-dev @@ -115,8 +134,6 @@ jobs: with: context: ./docker/production platforms: linux/amd64,linux/arm64 - build-args: | - VERSION=${{ steps.version.outputs.version }} push: true tags: | ${{ env.IMAGE_NAME }}:${{ steps.version.outputs.version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c4c90572..9c76df80 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -123,13 +123,13 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} R2_ENDPOINTS: ${{ secrets.R2_ENDPOINTS }} - R2_BUCKET: ${{ secrets.R2_BUCKET || 'get-yaoapps' }} + R2_BUCKET: ${{ secrets.R2_BUCKET || 'releases' }} run: | aws configure set default.region us-east-1 aws configure set default.s3.signature_version s3v4 VERSION="${{ steps.version.outputs.version }}" - PREFIX="releases/yao/${VERSION}" + PREFIX="yao/${VERSION}" echo "Uploading release binaries to R2: ${PREFIX}" diff --git a/.github/workflows/update-cdn-latest.yml b/.github/workflows/update-cdn-latest.yml index 4bc198c3..31ece8ba 100644 --- a/.github/workflows/update-cdn-latest.yml +++ b/.github/workflows/update-cdn-latest.yml @@ -1,6 +1,6 @@ name: Update CDN latest.json -# Assembles releases/yao/latest.json after all platform binaries are on R2. +# Assembles yao/latest.json after all platform binaries are on R2. # # Normally triggered automatically by notarize-macos.yml's finalize job after # notarization completes. Can also be triggered manually as a fallback. @@ -14,7 +14,7 @@ on: description: "Engine version to publish (e.g. 1.0.0 or 1.0.0-alpha)" required: true mark_latest: - description: "Also update releases/yao/latest.json (set false for pre-releases you want on CDN but not as latest)" + description: "Also update yao/latest.json (set false for pre-releases you want on CDN but not as latest)" required: false default: "true" @@ -28,7 +28,7 @@ jobs: AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }} R2_ENDPOINTS: ${{ secrets.R2_ENDPOINTS }} - R2_BUCKET: ${{ secrets.R2_BUCKET || 'get-yaoapps' }} + R2_BUCKET: ${{ secrets.R2_BUCKET || 'releases' }} CDN_BASE: https://get.yaoapps.com steps: - name: Configure AWS CLI @@ -39,7 +39,7 @@ jobs: - name: Verify platform assets exist run: | VERSION="${{ github.event.inputs.version }}" - PREFIX="releases/yao/${VERSION}" + PREFIX="yao/${VERSION}" PLATFORMS=( "darwin-arm64" @@ -76,7 +76,7 @@ jobs: python3 < /tmp/latest.json import json version = "${VERSION}" - base = "${CDN_BASE}/releases/yao/${VERSION}" + base = "${CDN_BASE}/yao/${VERSION}" assets = { "darwin-arm64": f"{base}/yao-{version}-darwin-arm64", "darwin-amd64": f"{base}/yao-{version}-darwin-amd64", @@ -104,17 +104,17 @@ jobs: run: | VERSION="${{ github.event.inputs.version }}" aws s3 cp /tmp/latest.json \ - "s3://${R2_BUCKET}/releases/yao/${VERSION}/latest.json" \ + "s3://${R2_BUCKET}/yao/${VERSION}/latest.json" \ --endpoint-url "$R2_ENDPOINTS" \ --content-type "application/json" \ --cache-control "public, max-age=60" - - name: Promote to releases/yao/latest.json + - name: Promote to yao/latest.json if: ${{ github.event.inputs.mark_latest != 'false' }} run: | aws s3 cp /tmp/latest.json \ - "s3://${R2_BUCKET}/releases/yao/latest.json" \ + "s3://${R2_BUCKET}/yao/latest.json" \ --endpoint-url "$R2_ENDPOINTS" \ --content-type "application/json" \ --cache-control "public, max-age=60" - echo "Promoted to releases/yao/latest.json" + echo "Promoted to yao/latest.json" diff --git a/cmd/root.go b/cmd/root.go index 5bd8ed96..f9f84358 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -56,29 +56,29 @@ var langs = map[string]string{ "✨STOPPED✨": "✨服务已停止✨", "SessionPort": "会话服务端口", "Force migrate": "强制更新数据表结构", - "Migrate is not allowed on production mode.": "Migrate 不能再生产环境下使用", - "Upgrade yao to latest version": "升级 yao 到最新版本", - "Current version:": "当前版本:", - "Latest version: ": "最新版本: ", - "Checking latest version...": "正在检查最新版本...", - "🎉Current version is the latest🎉": "🎉当前版本是最新的🎉", - "Do you want to update to %s ? (y/n): ": "是否更新到 %s ? (y/n): ", - "Invalid input": "输入错误", - "Canceled upgrade": "已取消更新", - "Downloading...": "正在下载...", - "Progress:": "进度:", - "Available assets:": "可用的制品:", - "Error occurred while updating binary: %s": "更新二进制文件时出错: %s", - "🎉Successfully updated to version: %s🎉": "🎉成功更新到版本: %s🎉", - "Skip interactive confirmation": "跳过交互式确认", - "Only check for updates and print JSON result": "仅检查更新并输出 JSON 结果", - "Custom download source URL (e.g. https://get.yaoapps.com/releases/yao)": "自定义下载源 URL (例如 https://get.yaoapps.com/releases/yao)", - "Print all version information": "显示详细版本信息", - "SUI Template Engine": "SUI 模板引擎命令", - "MCP commands": "MCP 包管理命令", - "MCP package management commands": "MCP 包管理命令", - "Robot commands": "Robot 包管理命令", - "Robot package management commands": "Robot 包管理命令", + "Migrate is not allowed on production mode.": "Migrate 不能再生产环境下使用", + "Upgrade yao to latest version": "升级 yao 到最新版本", + "Current version:": "当前版本:", + "Latest version: ": "最新版本: ", + "Checking latest version...": "正在检查最新版本...", + "🎉Current version is the latest🎉": "🎉当前版本是最新的🎉", + "Do you want to update to %s ? (y/n): ": "是否更新到 %s ? (y/n): ", + "Invalid input": "输入错误", + "Canceled upgrade": "已取消更新", + "Downloading...": "正在下载...", + "Progress:": "进度:", + "Available assets:": "可用的制品:", + "Error occurred while updating binary: %s": "更新二进制文件时出错: %s", + "🎉Successfully updated to version: %s🎉": "🎉成功更新到版本: %s🎉", + "Skip interactive confirmation": "跳过交互式确认", + "Only check for updates and print JSON result": "仅检查更新并输出 JSON 结果", + "Custom download source URL (e.g. https://get.yaoapps.com/yao)": "自定义下载源 URL (例如 https://get.yaoapps.com/yao)", + "Print all version information": "显示详细版本信息", + "SUI Template Engine": "SUI 模板引擎命令", + "MCP commands": "MCP 包管理命令", + "MCP package management commands": "MCP 包管理命令", + "Robot commands": "Robot 包管理命令", + "Robot package management commands": "Robot 包管理命令", } // L Language switch diff --git a/cmd/upgrade.go b/cmd/upgrade.go index cc5e935f..6b3bdb53 100644 --- a/cmd/upgrade.go +++ b/cmd/upgrade.go @@ -18,7 +18,7 @@ import ( ) const githubReleasesAPI = "https://api.github.com/repos/YaoApp/yao/releases/latest" -const cdnFallbackBase = "https://get.yaoapps.com/releases/yao" +const cdnFallbackBase = "https://get.yaoapps.com/yao" // Upgrade command flags var ( @@ -164,7 +164,7 @@ func resolveLatest() (string, string, error) { // resolveFromCDN fetches latest.json from the given CDN base URL. // The URL should point to the directory containing latest.json, -// e.g. "https://get.yaoapps.com/releases/yao". +// e.g. "https://get.yaoapps.com/yao". func resolveFromCDN(base string) (string, string, error) { url := strings.TrimRight(base, "/") + "/latest.json" client := &http.Client{Timeout: 30 * time.Second} @@ -438,5 +438,5 @@ func copyFile(src, dst string) error { func init() { upgradeCmd.Flags().BoolVarP(&upgradeYes, "yes", "y", false, L("Skip interactive confirmation")) upgradeCmd.Flags().BoolVar(&upgradeCheck, "check", false, L("Only check for updates and print JSON result")) - upgradeCmd.Flags().StringVar(&upgradeSource, "source", "", L("Custom download source URL (e.g. https://get.yaoapps.com/releases/yao)")) + upgradeCmd.Flags().StringVar(&upgradeSource, "source", "", L("Custom download source URL (e.g. https://get.yaoapps.com/yao)")) } diff --git a/docker/development/Dockerfile b/docker/development/Dockerfile index e8dd7e36..053210ad 100644 --- a/docker/development/Dockerfile +++ b/docker/development/Dockerfile @@ -4,14 +4,12 @@ # docker run --rm yaoapp/yao:1.0.0-alpha-dev yao version # =========================================== FROM ubuntu:24.04 -ARG VERSION ARG TARGETARCH RUN groupadd -r yao && useradd -r -g yao yao && \ apt-get update && \ apt-get install -y curl sudo procps net-tools -RUN curl -fsSL "https://pub-80136338e60643edbb55c6ca8a689cf8.r2.dev/archives/yao-${VERSION}-linux-${TARGETARCH}" > /usr/local/bin/yao && \ - chmod +x /usr/local/bin/yao && \ - mkdir -p /data/app +COPY yao-${TARGETARCH} /usr/local/bin/yao +RUN chmod +x /usr/local/bin/yao && mkdir -p /data/app VOLUME /data/app WORKDIR /data/app diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index 615b14ba..60bd463a 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -4,11 +4,10 @@ # docker run --rm yaoapp/yao:1.0.0-alpha yao version # =========================================== FROM alpine:latest -ARG VERSION ARG TARGETARCH -RUN apk --no-cache add curl -RUN curl -fsSL "https://pub-80136338e60643edbb55c6ca8a689cf8.r2.dev/archives/yao-${VERSION}-linux-${TARGETARCH}-prod" > /usr/local/bin/yao && \ - chmod +x /usr/local/bin/yao && \ +RUN apk --no-cache add curl +COPY yao-${TARGETARCH} /usr/local/bin/yao +RUN chmod +x /usr/local/bin/yao && \ addgroup -S yao && adduser -S -G yao yao && \ mkdir -p /data/app && \ chown -R yao:yao /data/app