Build Binaries #5
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 Binaries | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
arch: [amd64, arm64] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.23' # Correct Go version format | |
- name: Build binaries | |
run: | | |
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
if [[ "${{ matrix.arch }}" == "amd64" ]]; then | |
GOOS=linux GOARCH=amd64 go build -o myapp . | |
zip varunastra_linux_amd64.zip myapp | |
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then | |
GOOS=linux GOARCH=arm64 go build -o myapp . | |
zip varunastra_linux_arm64.zip myapp | |
fi | |
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
if [[ "${{ matrix.arch }}" == "amd64" ]]; then | |
GOOS=darwin GOARCH=amd64 go build -o myapp . | |
zip varunastra_darwin_amd64.zip myapp | |
elif [[ "${{ matrix.arch }}" == "arm64" ]]; then | |
GOOS=darwin GOARCH=arm64 go build -o myapp . | |
zip varunastra_darwin_arm64.zip myapp | |
fi | |
fi | |
- name: Upload binaries to release | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag: ${{ github.event.release.tag_name }} | |
files: | | |
varunastra_linux_amd64.zip | |
varunastra_linux_arm64.zip | |
varunastra_darwin_amd64.zip | |
varunastra_darwin_arm64.zip |