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 Release | |
on: | |
push: | |
tags: | |
- "v*" | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
- name: Build for multiple platforms | |
run: | | |
mkdir -p builds | |
# Linux build | |
GOOS=linux GOARCH=amd64 go build -o builds/tcp_client_linux_amd64 . | |
# Windows build | |
GOOS=windows GOARCH=amd64 go build -o builds/tcp_client_windows_amd64.exe . | |
# MacOS build with additional flags | |
GOOS=darwin GOARCH=amd64 go build -ldflags="-w -s" -o builds/tcp_client_darwin_amd64 . | |
cd builds && zip tcp_client_darwin_amd64.zip tcp_client_darwin_amd64 && cd .. | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
builds/tcp_client_linux_amd64 | |
builds/tcp_client_windows_amd64.exe | |
builds/tcp_client_darwin_amd64.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |