v0.12.15-rc3 #48
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, ${{ matrix.os }} | |
steps: | |
- name: Fix CRLF on Windows | |
if: runner.os == 'Windows' | |
run: git config --global core.autocrlf false | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- name: Setup Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.21 | |
- 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: | | |
go build -v -ldflags="-s -w -extldflags=-static" -tags netgo,osusergo -o ./bin/ . ./cmd/... | |
archive="bin/kaspad-${{ github.event.release.tag_name }}-linux.zip" | |
asset_name="kaspad-${{ github.event.release.tag_name }}-linux.zip" | |
zip -r "${archive}" ./bin/* | |
echo "archive=${archive}" >> $GITHUB_ENV | |
echo "asset_name=${asset_name}" >> $GITHUB_ENV | |
- name: Build on Windows | |
if: runner.os == 'Windows' | |
shell: bash | |
run: | | |
go build -v -ldflags="-s -w" -o bin/ . ./cmd/... | |
archive="bin/kaspad-${{ github.event.release.tag_name }}-win64.zip" | |
asset_name="kaspad-${{ github.event.release.tag_name }}-win64.zip" | |
powershell "Compress-Archive bin/* \"${archive}\"" | |
echo "archive=${archive}" >> $GITHUB_ENV | |
echo "asset_name=${asset_name}" >> $GITHUB_ENV | |
- name: Build on MacOS | |
if: runner.os == 'macOS' | |
run: | | |
go build -v -ldflags="-s -w" -o ./bin/ . ./cmd/... | |
archive="bin/kaspad-${{ github.event.release.tag_name }}-osx.zip" | |
asset_name="kaspad-${{ github.event.release.tag_name }}-osx.zip" | |
zip -r "${archive}" ./bin/* | |
echo "archive=${archive}" >> $GITHUB_ENV | |
echo "asset_name=${asset_name}" >> $GITHUB_ENV | |
- 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.archive }}" | |
asset_name: "${{ env.asset_name }}" | |
asset_content_type: application/zip |