-
Notifications
You must be signed in to change notification settings - Fork 10
55 lines (46 loc) · 1.58 KB
/
go.yml
File metadata and controls
55 lines (46 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Build Go Engine for All Platforms
on:
workflow_dispatch:
push:
branches: [ "main" ]
paths: [ 'core_engine/**' ]
jobs:
build:
# ! Use a matrix strategy to run the job for each platform
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
# * Run the job on the OS specified in the matrix
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Install Dependencies
run: go mod tidy
working-directory: ./core_engine
# ! Define different output names for each OS
- name: Set output executable name
id: set_name
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
echo "EXE_NAME=core_engine.exe" >> $GITHUB_ENV
echo "ARTIFACT_NAME=go-engine-windows" >> $GITHUB_ENV
elif [ "${{ runner.os }}" == "macOS" ]; then
echo "EXE_NAME=core_engine_macos" >> $GITHUB_ENV
echo "ARTIFACT_NAME=go-engine-macos" >> $GITHUB_ENV
else
echo "EXE_NAME=core_engine_linux" >> $GITHUB_ENV
echo "ARTIFACT_NAME=go-engine-linux" >> $GITHUB_ENV
fi
- name: Build Go Executable
run: go build -v -o ${{ env.EXE_NAME }} main.go
working-directory: ./core_engine
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_NAME }}
path: core_engine/${{ env.EXE_NAME }}