name: Build and Upload assets on: release: types: [published] jobs: build: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] name: Building For ${{ matrix.os }} steps: - name: Fix windows CRLF run: git config --global core.autocrlf false - name: Check out code into the Go module directory uses: actions/checkout@v2 # We need to increase the page size because the tests run out of memory on github CI windows. # Use the powershell script from this github action: https://github.com/al-cheb/configure-pagefile-action/blob/master/scripts/SetPageFileSize.ps1 # MIT License (MIT) Copyright (c) 2020 Maxim Lobanov and contributors - name: Increase page size on windows if: runner.os == 'Windows' shell: powershell run: powershell -command .\.github\workflows\SetPageFileSize.ps1 - name: Set up Go 1.x uses: actions/setup-go@v2 with: go-version: 1.16 - name: Build on linux if: runner.os == 'Linux' # `-extldflags=-static` - means static link everything, `-tags netgo,osusergo` means use pure go replacements for "os/user" and "net" # `-s -w` strips the binary to produce smaller size binaries run: | binary="kaspad-${{ github.event.release.tag_name }}-linux" echo "binary=${binary}" >> $GITHUB_ENV go build -v -ldflags="-s -w -extldflags=-static" -tags netgo,osusergo -o "${binary}" - name: Build on Windows if: runner.os == 'Windows' shell: bash run: | binary="kaspad-${{ github.event.release.tag_name }}-win64.exe" echo "binary=${binary}" >> $GITHUB_ENV go build -v -ldflags="-s -w" -o "${binary}" - name: Build on MacOS if: runner.os == 'macOS' run: | binary="kaspad-${{ github.event.release.tag_name }}-osx" echo "binary=${binary}" >> $GITHUB_ENV go build -v -ldflags="-s -w" -o "${binary}" - name: Upload Release Asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.release.upload_url }} asset_path: "./${{ env.binary }}" asset_name: "${{ env.binary }}" asset_content_type: application/zip