From a4db7384bf1cd4c00ab080f422b1368a77ebdea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=8F=E5=88=97=E5=8F=B7?= <2402324010@qq.com> Date: Sun, 19 Mar 2023 18:53:14 +0800 Subject: [PATCH] Update ci.yml --- .github/workflows/ci.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75cdd12..233b93b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,6 +8,7 @@ env: COMMIT_ID: "${{ github.sha }}" PR_PROMPT: "::warning:: Build artifact will not be uploaded due to the workflow is trigged by pull request." LD_FLAGS: "-w -s" + HEAD_REF: "true" jobs: build: @@ -55,15 +56,17 @@ jobs: go build -o "output/$BINARY_NAME" -trimpath -ldflags "$LD_FLAGS" ./ - name: Upload artifact uses: actions/upload-artifact@v2 - if: ${{ !github.head_ref }} + if: ${{ !head_ref }} with: name: ${{ matrix.goos }}_${{ matrix.goarch }} path: output/ - - name: Upload firmware directory - uses: actions/upload-artifact@main - if: true + - name: Upload firmware to release + uses: softprops/action-gh-release@v1 + if: ${{ head_ref }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - name: ${{ matrix.goos }}_${{ matrix.goarch }} - path: output/ + tag_name: ${{ matrix.goos }}_${{ matrix.goarch }} + files: output/*