Skip to content

Commit

Permalink
🔧 github actions enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
yusufcanb committed Feb 16, 2024
1 parent 10d7f12 commit d979d08
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build
on:
push:
branches: [ "master", "feature/*", "bugfix/*" ]
pull_request:
branches: [ "master", ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20

- name: Install Deps
run: go get ./...

- name: Build
run: go build -o tlama cmd/cli.go
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@

# Go workspace file
go.work
.idea
.idea
dist
46 changes: 46 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# Operating systems to target
targets=("darwin" "linux" "windows")

# Architecture (currently hardcoded to 64-bit)
arch="amd64"

# Function to perform builds
build() {
os=$1
app_name=$2
version=$3

# Determine output filename with optional .exe extension
output_name="${app_name}_${version}_${os}_${arch}"
if [[ "$os" == "windows" ]]; then
output_name="${output_name}.exe"
fi

echo "Building for $os/$arch (version: $version) -> $output_name"
GOOS=$os GOARCH=$arch go build -o "dist/${output_name}" "cmd/cli.go"
}

# Replace this with the name of your main Go file (package)
app_name="tlama"

# Process command-line argument for version
if [ $# -eq 0 ]; then
echo "Error: Please provide a version number as a command-line argument."
exit 1
fi
version=$1

# Clear old build artifacts
rm -rf dist

# Create the output directory
mkdir dist

# Build for each OS
for os in "${targets[@]}"; do
build $os $app_name $version
done

echo "Done!"

0 comments on commit d979d08

Please sign in to comment.