From ffe1b65a2b5c6349df9bab828df6176d9aad019e Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Sun, 20 Jul 2025 13:02:52 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0goreleaser-action?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build_binary.yaml | 35 +++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_binary.yaml b/.github/workflows/build_binary.yaml index 54a7201..5990cdd 100644 --- a/.github/workflows/build_binary.yaml +++ b/.github/workflows/build_binary.yaml @@ -32,11 +32,42 @@ jobs: GITHUB_TOKEN: ${{ secrets.GHT }} - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v2 + uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser version: latest args: release env: GITHUB_TOKEN: ${{ secrets.GHT }} - GOPRIVATE: github.com/oneclickvirt/security \ No newline at end of file + GOPRIVATE: github.com/oneclickvirt/security + + - name: Update goecs.sh with new version + run: | + if [[ "$GITHUB_REF" == refs/tags/* ]]; then + VERSION="${GITHUB_REF#refs/tags/v}" + else + VERSION=$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//' || echo "0.1.37") + fi + echo "Using version: $VERSION" + FILE="goecs.sh" + BRANCH="master" + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git config --global --unset url."git@github.com:".insteadOf || true + git fetch origin $BRANCH + git checkout $BRANCH + if [ ! -f "$FILE" ]; then + echo "Error: $FILE not found" + exit 1 + fi + sed -i "s/\(_yellow \"Unable to get version info, using default version \).*\(\".*\)/\1$VERSION\2/" "$FILE" + sed -i "s/\(ECS_VERSION=\"\).*\(\"\)/\1$VERSION\2/" "$FILE" + if git diff --quiet "$FILE"; then + echo "No changes detected in $FILE" + exit 0 + fi + git add "$FILE" + git commit -m "chore: update ECS_VERSION to $VERSION in goecs.sh" + git push origin $BRANCH + env: + GITHUB_TOKEN: ${{ secrets.GHT }} \ No newline at end of file