diff --git a/.github/workflows/on-release.yaml b/.github/workflows/on-release.yaml index 930db3b..b8c37d1 100644 --- a/.github/workflows/on-release.yaml +++ b/.github/workflows/on-release.yaml @@ -31,14 +31,7 @@ jobs: goos: windows goarch: amd64 runs-on: ${{ matrix.runner }} - env: - GOOS: ${{ matrix.goos }} - GOARCH: ${{ matrix.goarch }} - # Examples: - # - 'network-hub-linux-amd64' - # - 'network-hub-windows-amd64.exe' - # - 'network-hub-macos-arm64' - EXECUTABLE_NAME: network-hub-${{ matrix.goos == 'darwin' && 'macos' || matrix.goos }}-${{ matrix.goarch }}${{ runner.os == 'Windows' && '.exe' || '' }} + steps: - name: Checkout code uses: actions/checkout@v4 @@ -48,12 +41,19 @@ jobs: with: go-version: 1.22.x + - name: Setup Executable Name + # Examples: + # - 'network-hub-linux-amd64' + # - 'network-hub-windows-amd64.exe' + # - 'network-hub-macos-arm64' + run: echo "EXECUTABLE_NAME=network-hub-${{ matrix.goos == 'darwin' && 'macos' || matrix.goos }}-${{ matrix.goarch }}${{ runner.os == 'Windows' && '.exe' || '' }}" >> $GITHUB_ENV + - name: Build binary env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} run: | - go build -v -o $EXECUTABLE_NAME ./cmd/main.go + go build -v -o ${{ env.EXECUTABLE_NAME }} ./cmd/main.go - name: Upload Executable uses: xresloader/upload-to-github-release@v1.6.0 @@ -61,5 +61,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ inputs.tag || github.ref_name }} - file: $EXECUTABLE_NAME + file: ${{ env.EXECUTABLE_NAME }} overwrite: true