From 069cf0ff3d6a3601fdaed06278f463764718fc87 Mon Sep 17 00:00:00 2001 From: Eugen Eisler Date: Thu, 12 Sep 2024 19:35:23 +0200 Subject: [PATCH] ci: work on artifact names for upload --- .github/workflows/release.yml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a583f13..b71c045 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -51,13 +51,10 @@ jobs: run: | if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then echo "OS=linux" >> $GITHUB_ENV - echo "EXT=" >> $GITHUB_ENV elif [ "${{ matrix.os }}" == "macos-latest" ]; then echo "OS=darwin" >> $GITHUB_ENV - echo "EXT=" >> $GITHUB_ENV else echo "OS=windows" >> $GITHUB_ENV - echo "EXT=.exe" >> $GITHUB_ENV fi shell: bash @@ -67,7 +64,7 @@ jobs: GOOS: ${{ env.OS }} GOARCH: ${{ matrix.arch }} run: | - go build -o fabric-${OS}-${{ matrix.arch }}-${{ github.ref_name }} . + go build -o fabric-${OS}-${{ matrix.arch }} . - name: Build binary on Windows if: matrix.os == 'windows-latest' @@ -75,13 +72,21 @@ jobs: GOOS: windows GOARCH: ${{ matrix.arch }} run: | - go build -o fabric-${OS}-${{ matrix.arch }}-${{ github.ref_name }}${EXT} . + go build -o fabric-windows-${{ matrix.arch }}.exe . - name: Upload build artifact + if: matrix.os != 'windows-latest' uses: actions/upload-artifact@v3 with: - name: fabric-${OS}-${{ matrix.arch }}-${{ github.ref_name }} - path: fabric-${OS}-${{ matrix.arch }}-${{ github.ref_name }}${EXT} + name: fabric-${OS}-${{ matrix.arch }} + path: fabric-${OS}-${{ matrix.arch }} + + - name: Upload build artifact + if: matrix.os == 'windows-latest' + uses: actions/upload-artifact@v3 + with: + name: fabric-windows-${{ matrix.arch }}.exe + path: fabric-windows-${{ matrix.arch }}.exe - name: Create release if it doesn't exist if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') @@ -91,8 +96,15 @@ jobs: gh release view ${{ github.ref_name }} || gh release create ${{ github.ref_name }} --title "Release ${{ github.ref_name }}" --notes "Automated release for ${{ github.ref_name }}" - name: Upload release artifact - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && matrix.os == 'windows-latest' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release upload ${{ github.ref_name }} fabric-${OS}-${{ matrix.arch }}-${{ github.ref_name }}${EXT} + gh release upload ${{ github.ref_name }} fabric-windows-${{ matrix.arch }}.exe + + - name: Upload release artifact + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && matrix.os != 'windows-latest' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh release upload ${{ github.ref_name }} fabric-${OS}-${{ matrix.arch }}