Skip to content

Commit 3d6698a

Browse files
authored
Merge pull request #16 from CodeIter/feature/github-actions-workflows
feat: Add GitHub Actions for CI and Release This commit introduces two new GitHub Actions workflows: - `ci.yml`: Builds the application on every push to `main` and on pull requests targeting `main`. - `release.yml`: Builds the application for Linux, Windows, and macOS, and creates a GitHub Release with the binaries when a version tag is pushed. The `Makefile` has been updated to support cross-platform builds.
2 parents fceb300 + 24687e9 commit 3d6698a

File tree

3 files changed

+71
-1
lines changed

3 files changed

+71
-1
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v4
17+
with:
18+
go-version: '1.20'
19+
20+
- name: Build
21+
run: make build

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
name: Create Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: '1.20'
20+
21+
- name: Build for all platforms
22+
run: |
23+
make build-linux
24+
make build-windows
25+
make build-macos
26+
27+
- name: Create Release
28+
uses: softprops/action-gh-release@v1
29+
with:
30+
files: |
31+
nvidia-ai-chat-linux-amd64
32+
nvidia-ai-chat-windows-amd64.exe
33+
nvidia-ai-chat-darwin-amd64
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,19 @@ run: build
2222

2323
clean:
2424
@echo "Cleaning up..."
25-
rm -f $(APP_NAME) $(APP_NAME).exe
25+
rm -f $(APP_NAME) $(APP_NAME).exe nvidia-ai-chat-*-amd64 nvidia-ai-chat-*-amd64.exe
26+
27+
.PHONY: build-linux build-windows build-macos
28+
29+
build-linux:
30+
@echo "Building for Linux (amd64)..."
31+
GOOS=linux GOARCH=amd64 go build -o nvidia-ai-chat-linux-amd64 .
32+
33+
build-windows:
34+
@echo "Building for Windows (amd64)..."
35+
GOOS=windows GOARCH=amd64 go build -o nvidia-ai-chat-windows-amd64.exe .
36+
37+
build-macos:
38+
@echo "Building for macOS (amd64)..."
39+
GOOS=darwin GOARCH=amd64 go build -o nvidia-ai-chat-darwin-amd64 .
2640

0 commit comments

Comments
 (0)