From f607957365b57087c3a1763de134e0a70299befa Mon Sep 17 00:00:00 2001 From: Akizon77 Date: Tue, 29 Apr 2025 21:07:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20text=20=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=E4=BA=8C=E8=BF=9B=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release.yml | 72 +++++++++++++++-------------------- 1 file changed, 30 insertions(+), 42 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c0b1922..e40fb6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,57 +1,45 @@ -name: Release +name: Build and Attach Binaries to Release on: release: - types: [created] + types: [published] jobs: - build: - runs-on: ${{ matrix.os }} + build-and-attach: + runs-on: ubuntu-latest + strategy: matrix: - os: [ubuntu-latest, windows-latest, macos-latest] - include: - - os: ubuntu-latest - artifact_name: komari-agent-linux-amd64 - goos: linux - goarch: amd64 - - os: ubuntu-latest - artifact_name: komari-agent-linux-arm64 - goos: linux - goarch: arm64 - - os: windows-latest - artifact_name: komari-agent-windows-amd64.exe - goos: windows - goarch: amd64 - - os: windows-latest - artifact_name: komari-agent-windows-arm64.exe - goos: windows - goarch: arm64 - - os: macos-latest - artifact_name: komari-agent-darwin-amd64 - goos: darwin - goarch: amd64 - - os: macos-latest - artifact_name: komari-agent-darwin-arm64 - goos: darwin - goarch: arm64 + goos: [windows, linux] + goarch: [amd64, arm64] steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 + - name: Checkout code + uses: actions/checkout@v4 - name: Set up Go - uses: actions/setup-go@v4 + uses: actions/setup-go@v5 with: go-version: '1.23' - - name: Build - run: GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o ${{ matrix.artifact_name }} . - - - name: Upload Release Asset - uses: softprops/action-gh-release@v1 - with: - files: ${{ matrix.artifact_name }} + - name: Build binary env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + run: | + BINARY_NAME=myapp-${{ matrix.goos }}-${{ matrix.goarch }} + if [ "${{ matrix.goos }}" = "windows" ]; then + BINARY_NAME=${BINARY_NAME}.exe + fi + go build -o $BINARY_NAME + + - name: Upload binary to release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + BINARY_NAME=myapp-${{ matrix.goos }}-${{ matrix.goarch }} + if [ "${{ matrix.goos }}" = "windows" ]; then + BINARY_NAME=${BINARY_NAME}.exe + fi + gh release upload ${{ github.event.release.tag_name }} $BINARY_NAME --repo ${{ github.repository }} + shell: bash \ No newline at end of file