Skip to content

Fix build.yml

Fix build.yml #113

Workflow file for this run

name: Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
configuration: [Release, Debug]
env:
PROJECT_NAME: BallanceModLoaderPlus
BASE_BUILD_DIR: ${{ github.workspace }}/build
BASE_DIST_DIR: ${{ github.workspace }}/dist
steps:
- name: Checkout source code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout Virtools SDK
uses: actions/checkout@v4
with:
repository: doyaGu/Virtools-SDK-2.1
path: ${{ github.workspace }}/Virtools-SDK-2.1
- name: Get current branch and commit hash
shell: bash
run: |
echo "GIT_BRANCH=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
echo "GIT_SHA=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV"
- name: Setup CMake
uses: lukka/get-cmake@latest
- name: Setup MSVC
uses: TheMrMilchmann/setup-msvc-dev@v3.0.0
with:
arch: x86
- name: Configure CMake
run: >
cmake -A Win32 -B ${{ env.BASE_BUILD_DIR }}/${{ matrix.configuration }}
-DCMAKE_BUILD_TYPE=${{ matrix.configuration }}
-DVIRTOOLS_SDK_PATH=${{ github.workspace }}/Virtools-SDK-2.1
-DCMAKE_INSTALL_PREFIX=${{ env.BASE_DIST_DIR }}/${{ matrix.configuration }}
- name: Build the project
run: cmake --build ${{ env.BASE_BUILD_DIR }}/${{ matrix.configuration }} --config ${{ matrix.configuration }}
- name: Install binaries to distribution folder
run: >
cmake --install ${{ env.BASE_BUILD_DIR }}/${{ matrix.configuration }}
--prefix ${{ env.BASE_DIST_DIR }}/${{ matrix.configuration }} --config ${{ matrix.configuration }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ env.PROJECT_NAME }}-${{ env.GIT_SHA }}-${{ matrix.configuration }}
path: ${{ env.BASE_DIST_DIR }}/${{ matrix.configuration }}