Skip to content

Commit

Permalink
chore: github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
evoxmusic committed Dec 1, 2024
1 parent 13fe46a commit 3ad4ab2
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Build and Release

on:
push:
tags:
- 'v*'

jobs:
build:
name: Build and Release
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.23'
cache: true

- name: Get version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Build for all platforms
run: |
# Create build directory
mkdir -p build
# Build for MacOS (both ARM and AMD64)
GOOS=darwin GOARCH=arm64 go build -o build/app-darwin-arm64 main.go
GOOS=darwin GOARCH=amd64 go build -o build/app-darwin-amd64 main.go
# Build for Linux
GOOS=linux GOARCH=amd64 go build -o build/app-linux-amd64 main.go
GOOS=linux GOARCH=arm64 go build -o build/app-linux-arm64 main.go
# Build for Windows
GOOS=windows GOARCH=amd64 go build -o build/app-windows-amd64.exe main.go
# Create ZIP archives for each binary
cd build
for file in *; do
zip "${file}.zip" "$file"
done
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
build/*.zip
name: Release ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 3ad4ab2

Please sign in to comment.