|
| 1 | +# .github/workflows/build-go.yml |
| 2 | + |
| 3 | +name: Build Go Engine |
| 4 | + |
| 5 | +# ! Controls when the workflow will run |
| 6 | +on: |
| 7 | + # * Allows you to run this workflow manually from the Actions tab |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | + # * Also runs on pushes to the main branch (optional, but good for testing) |
| 11 | + push: |
| 12 | + branches: [ "main" ] |
| 13 | + paths: |
| 14 | + - 'core_engine/**' # Only run if Go code changes |
| 15 | + |
| 16 | +jobs: |
| 17 | + build: |
| 18 | + # ! We want to build for Windows, so we use a Windows runner |
| 19 | + runs-on: windows-latest |
| 20 | + |
| 21 | + steps: |
| 22 | + # * Step 1: Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 23 | + - name: Checkout repository |
| 24 | + uses: actions/checkout@v4 |
| 25 | + |
| 26 | + # * Step 2: Set up Go environment on the runner |
| 27 | + - name: Set up Go |
| 28 | + uses: actions/setup-go@v5 |
| 29 | + with: |
| 30 | + go-version: '1.22' # You can change this to a newer version if you want |
| 31 | + |
| 32 | + # * Step 3: Download Go dependencies (the 'go mod tidy' command) |
| 33 | + - name: Install Dependencies |
| 34 | + run: go mod tidy |
| 35 | + # * We tell GitHub to run this command inside the core_engine directory |
| 36 | + working-directory: ./core_engine |
| 37 | + |
| 38 | + # * Step 4: Build the Go application for Windows |
| 39 | + - name: Build Go Executable |
| 40 | + run: go build -v -o core_engine.exe main.go |
| 41 | + working-directory: ./core_engine |
| 42 | + |
| 43 | + # * Step 5: Upload the built executable as an artifact |
| 44 | + - name: Upload Artifact |
| 45 | + uses: actions/upload-artifact@v4 |
| 46 | + with: |
| 47 | + # * This will be the name of the downloadable file |
| 48 | + name: go-engine-windows |
| 49 | + # * This is the path to the file we want to upload |
| 50 | + path: core_engine/core_engine.exe |
0 commit comments