Skip to content

Add files via upload #8

Add files via upload

Add files via upload #8

Workflow file for this run

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 }}