From 7aeaa7b0d2f50cf3feebf71207d97cf159b00681 Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 9 Jun 2026 21:47:56 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-release.yml | 44 ++++++----------------------- scripts/update_go_license.sh | 3 +- 2 files changed, 11 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index a2d7075f..a655e4e2 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -21,12 +21,6 @@ env: FRONTEND_BUILD_COMMAND: pnpm build:embed FRONTEND_OUT_DIR: frontend/out EMBED_DIST_DIR: internal/router/dist - EXTRA_FILES: | - LICENSE - README.md - README_zh.md - config.example.yaml - DEPLOYMENT_zh.md permissions: contents: write @@ -158,19 +152,16 @@ jobs: include: - goos: linux goarch: amd64 - archive: tar.gz - goos: linux goarch: arm64 - archive: tar.gz - goos: darwin goarch: amd64 - archive: tar.gz - goos: darwin goarch: arm64 - archive: tar.gz - goos: windows goarch: amd64 - archive: zip + - goos: windows + goarch: arm64 steps: - name: Checkout uses: actions/checkout@v4 @@ -204,7 +195,7 @@ jobs: build_args=( -trimpath - -ldflags "$GO_LDFLAGS" + -ldflags "$GO_LDFLAGS -X github.com/Rain-kl/Wavelet/internal/cmd.Version=$VERSION" -o "dist/$binary_name" ) @@ -214,42 +205,25 @@ jobs: go build "${build_args[@]}" "$GO_MAIN" - - name: Package artifact + - name: Rename binary for release id: package shell: bash env: VERSION: ${{ needs.create-release.outputs.version }} GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} - ARCHIVE_FORMAT: ${{ matrix.archive }} run: | set -euo pipefail - package_name="${APP_NAME}_${VERSION}_${GOOS}_${GOARCH}" - staging_dir="dist/$package_name" - mkdir -p "$staging_dir" - if [[ "$GOOS" == "windows" ]]; then - cp "dist/${APP_NAME}.exe" "$staging_dir/" + src="dist/${APP_NAME}.exe" + artifact="dist/${APP_NAME}_${VERSION}_${GOOS}_${GOARCH}.exe" else - cp "dist/${APP_NAME}" "$staging_dir/" - fi - - while IFS= read -r extra_file; do - [[ -z "$extra_file" ]] && continue - if [[ -e "$extra_file" ]]; then - cp -R "$extra_file" "$staging_dir/" - fi - done <<< "$EXTRA_FILES" - - if [[ "$ARCHIVE_FORMAT" == "zip" ]]; then - (cd dist && zip -r "${package_name}.zip" "$package_name") - artifact="dist/${package_name}.zip" - else - tar -C dist -czf "dist/${package_name}.tar.gz" "$package_name" - artifact="dist/${package_name}.tar.gz" + src="dist/${APP_NAME}" + artifact="dist/${APP_NAME}_${VERSION}_${GOOS}_${GOARCH}" fi + mv "$src" "$artifact" echo "artifact=$artifact" >> "$GITHUB_OUTPUT" - name: Upload release artifact diff --git a/scripts/update_go_license.sh b/scripts/update_go_license.sh index 252457a4..22a69c6f 100755 --- a/scripts/update_go_license.sh +++ b/scripts/update_go_license.sh @@ -48,7 +48,8 @@ changed=0 find_go_files() { find . \ - \( -path './.git' \ + \( -path './.*' \ + -o -path './docs' \ -o -path './frontend/node_modules' \ -o -path './frontend/.next' \ -o -path './frontend/out' \