Skip to content

Windows Build - Template #22

Windows Build - Template

Windows Build - Template #22

Workflow file for this run

name: Windows Build - Template
on:
workflow_dispatch:
inputs:
beamProj:
description: "The BEAMPROJ we are building. Ie: BEAMPROJ_Sandbox or BEAMPROJ_HathoraDemo."
required: true
default: "BEAMPROJ_Sandbox"
type: string
buildType:
type: choice
description: 'Either "client", for regular builds, or "server" for dedicated server builds.'
required: true
default: "client"
options:
- "client"
- "server"
targetPlatform:
type: choice
description: 'Either "Win64", for Windows builds, or "Linux" for Linux builds.'
required: true
default: "Win64"
options:
- "Win64"
- "Linux"
gitRevision:
type: string
description: Commit hash to use, can use branch names
required: true
default: dev
workflow_call:
inputs:
beamProj:
description: "The BEAMPROJ we are building. Ie: BEAMPROJ_Sandbox or BEAMPROJ_HathoraDemo."
required: true
default: "BEAMPROJ_Sandbox"
type: string
buildType:
type: string
description: 'Either "client", for regular builds, or "server" for dedicated server builds.'
required: true
default: "client"
targetPlatform:
type: string
description: 'Either "Win64", for Windows builds, or "Linux" for Linux builds.'
required: true
default: "Win64"
gitRevision:
type: string
description: Commit hash to use, can use branch names
required: true
default: dev
permissions:
contents: write
jobs:
build:
runs-on: [self-hosted, Windows]
steps:
# Gets the Unreal Repo and the CLI repo
- uses: actions/checkout@v4
with:
ref: ${{ inputs.gitRevision }}
fetch-depth: 0
lfs: true
path: BeamableUnreal/
- uses: actions/checkout@v4
with:
repository: beamable/BeamableProduct
fetch-depth: 0
lfs: true
path: BeamableProduct/
ref: main
# Caches the UnrealSDK repo's Intermediate and Saved folders
- uses: actions/cache@v4
continue-on-error: false
with:
path: |
BeamableUnreal/Intermediate
BeamableUnreal/Saved
BeamableUnreal/Plugins/BeamableCore/Intermediate
BeamableUnreal/Plugins/BeamableCore/Saved
BeamableUnreal/BeamableUnreal.sln
key: unreal-${{ runner.os }}-${{ inputs.targetPlatform }}-${{ inputs.buildType }}-${{ hashFiles('/BeamableUnreal/Source/**') }}
restore-keys: unreal-${{ runner.os }}-${{ inputs.targetPlatform }}-
# Installs .NET 8 so we can run prepare_repo.sh
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
# Make sure the .NET's paths are added to the shell's path ENV VAR
- run: Add-Content $env:GITHUB_PATH "C:\Program Files\dotnet"
- run: Add-Content $env:GITHUB_PATH "~\.dotnet\tools"
# Run Set-Packages for Unreal
- name: Run Set Packages for local build of the CLI
working-directory: ./BeamableProduct
shell: bash
run: bash set-packages.sh "${{ github.workspace }}/BeamableUnreal/" "UNREAL_NugetSource" "" "" "${{ github.workspace }}/BeamableUnreal/Microservices"
# Run prepare_repo.sh (needed to setup the project correctly locally)
- name: Prepare Repository for compilation
working-directory: ./BeamableUnreal
continue-on-error: true
shell: bash
run: bash prepare_repo.sh skip_waiting
# Sets the BEAMPROJ based on the input to this workflow.
- name: Set BeamProjOverride.txt
working-directory: ./BeamableUnreal
shell: bash
run: |
echo ${{ inputs.beamProj }} > BeamProjOverride.txt |
cat BeamProjOverride.txt
# Builds the image
- name: Build image
working-directory: ./BeamableUnreal
shell: bash
run: bash windows_build.sh ${{ inputs.buildType }} ${{ inputs.targetPlatform }}
# Compress the results
- name: Compress Directory
run: powershell Compress-Archive BeamableUnreal/PackagedProject ${{ inputs.targetPlatform }}_${{ inputs.buildType }}_${{ inputs.beamProj }}_${{ inputs.gitRevision }}.zip
# Uploads the artifacts so we can download the build
- name: Upload Compressed Folder as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.targetPlatform }}_${{ inputs.buildType }}_${{ inputs.beamProj }}_${{ inputs.gitRevision }}
path: ${{ inputs.targetPlatform }}_${{ inputs.buildType }}_${{ inputs.beamProj }}_${{ inputs.gitRevision }}.zip
- name: Cleanup workspace
if: always()
shell: bash
run: rm -rf .* && rm -rf *