Release workflow
This commit is contained in:
parent
b42341b73f
commit
805be7dbeb
153
.gitea/workflows/create-release.yml
Normal file
153
.gitea/workflows/create-release.yml
Normal file
@ -0,0 +1,153 @@
|
||||
name: Create Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version for this release (e.g. 1.0.0)'
|
||||
required: true
|
||||
default: ''
|
||||
version_type:
|
||||
description: 'Type of version increment'
|
||||
required: true
|
||||
default: 'patch'
|
||||
type: choice
|
||||
options:
|
||||
- major
|
||||
- minor
|
||||
- patch
|
||||
prerelease:
|
||||
description: 'Is this a pre-release?'
|
||||
required: true
|
||||
default: 'false'
|
||||
type: boolean
|
||||
description:
|
||||
description: 'Release description'
|
||||
required: false
|
||||
default: 'New release'
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
runs-on: macos
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get or increment version
|
||||
id: versioning
|
||||
run: |
|
||||
# Fetch all tags
|
||||
git fetch --tags
|
||||
|
||||
# Get the latest version tag, if any
|
||||
LATEST_TAG=$(git tag -l "v[0-9]*.[0-9]*.[0-9]*" | sort -V | tail -n1)
|
||||
|
||||
# If no input version provided, increment the latest tag
|
||||
INPUT_VERSION="${{ github.event.inputs.version }}"
|
||||
|
||||
if [ -z "$INPUT_VERSION" ] || [ "$INPUT_VERSION" = "" ]; then
|
||||
echo "No version specified, will calculate based on latest tag"
|
||||
|
||||
if [ -z "$LATEST_TAG" ]; then
|
||||
# No previous version tag, start with 1.0.0
|
||||
NEW_VERSION="1.0.0"
|
||||
echo "No previous version tags found, starting with 1.0.0"
|
||||
else
|
||||
# Strip 'v' prefix if it exists
|
||||
VERSION=${LATEST_TAG#v}
|
||||
|
||||
# Split version into parts
|
||||
MAJOR=$(echo $VERSION | cut -d. -f1)
|
||||
MINOR=$(echo $VERSION | cut -d. -f2)
|
||||
PATCH=$(echo $VERSION | cut -d. -f3)
|
||||
|
||||
# Increment based on version type
|
||||
case "${{ github.event.inputs.version_type }}" in
|
||||
major)
|
||||
MAJOR=$((MAJOR + 1))
|
||||
MINOR=0
|
||||
PATCH=0
|
||||
;;
|
||||
minor)
|
||||
MINOR=$((MINOR + 1))
|
||||
PATCH=0
|
||||
;;
|
||||
*) # Default is patch
|
||||
PATCH=$((PATCH + 1))
|
||||
;;
|
||||
esac
|
||||
|
||||
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
||||
echo "Incremented ${{ github.event.inputs.version_type }} version from ${VERSION} to ${NEW_VERSION}"
|
||||
fi
|
||||
else
|
||||
# Use provided version
|
||||
NEW_VERSION="${INPUT_VERSION}"
|
||||
echo "Using provided version: ${NEW_VERSION}"
|
||||
fi
|
||||
|
||||
# Save the version for later steps
|
||||
echo "VERSION=v${NEW_VERSION}" >> $GITHUB_ENV
|
||||
echo "VERSION_NUMBER=${NEW_VERSION}" >> $GITHUB_ENV
|
||||
echo "::set-output name=version::v${NEW_VERSION}"
|
||||
|
||||
echo "Final version: v${NEW_VERSION}"
|
||||
|
||||
- name: Download latest artifacts
|
||||
run: |
|
||||
mkdir -p Artifacts
|
||||
echo "Downloading latest build artifacts..."
|
||||
|
||||
# You can add specific download commands here if needed
|
||||
# For example, using curl to download from your CI system
|
||||
|
||||
# List what we have after download
|
||||
echo "Available artifacts:"
|
||||
ls -la Artifacts/ || echo "No artifacts found"
|
||||
|
||||
- name: Create Tag
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
||||
run: |
|
||||
TAG="${{ env.VERSION }}"
|
||||
echo "Creating git tag: $TAG"
|
||||
|
||||
# Configure git with token authentication
|
||||
git config --global user.email "actions@gitea.com"
|
||||
git config --global user.name "Gitea Actions"
|
||||
|
||||
# Direct token approach - simplest method
|
||||
git remote set-url origin "https://goran:${{ secrets.GITEATOKEN }}@luckyrobots.com/goran/lyra_game_ue.git"
|
||||
|
||||
# Set git to not prompt for input
|
||||
export GIT_TERMINAL_PROMPT=0
|
||||
|
||||
# Check if tag exists
|
||||
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
# Create tag without opening editor (-m flag)
|
||||
git tag -a "$TAG" -m "Release $TAG"
|
||||
|
||||
# Push with timeout and debug
|
||||
echo "Pushing tag $TAG to origin..."
|
||||
git push --verbose origin "$TAG" || {
|
||||
echo "Error: Failed to push tag. Check your token permissions."
|
||||
exit 1
|
||||
}
|
||||
echo "Successfully created and pushed tag: $TAG"
|
||||
else
|
||||
echo "Tag $TAG already exists, skipping tag creation"
|
||||
fi
|
||||
echo "RELEASE_TAG=$TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: Create Gitea Release
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
||||
uses: https://gitea.com/actions/gitea-release-action@main
|
||||
with:
|
||||
token: ${{ secrets.GITEATOKEN }}
|
||||
tag_name: ${{ env.RELEASE_TAG }}
|
||||
title: "Release ${{ env.RELEASE_TAG }}"
|
||||
files: |
|
||||
Builds/*.zip
|
||||
Artifacts/*.zip
|
@ -1,241 +1,241 @@
|
||||
name: Unreal Engine Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
branches: [main, develop]
|
||||
|
||||
jobs:
|
||||
windows-build:
|
||||
build-and-release:
|
||||
runs-on: windows
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
lfs: false
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup environment
|
||||
run: |
|
||||
# Set environment variables for Unreal Engine
|
||||
echo "UE_ROOT=E:/Games/UE_5.5" >> $env:GITHUB_ENV
|
||||
# Set environment variables for Linux toolchain
|
||||
$env:LINUX_MULTIARCH_ROOT = "C:/UnrealToolchains/v23_clang-18.1.0-rockylinux8"
|
||||
echo "LINUX_MULTIARCH_ROOT=$env:LINUX_MULTIARCH_ROOT" >> $env:GITHUB_ENV
|
||||
|
||||
# Create directories for builds
|
||||
mkdir -Force Builds/Windows
|
||||
mkdir -Force Builds/Linux
|
||||
mkdir -Force PackagedReleases
|
||||
|
||||
- name: Build for Windows
|
||||
run: |
|
||||
# Execute Windows build script
|
||||
if (Test-Path ./win_build.sh) {
|
||||
# Use Git Bash to run shell scripts
|
||||
& 'C:\Program Files\Git\bin\bash.exe' -c "./win_build.sh"
|
||||
} else {
|
||||
echo "Windows build script not found. Creating placeholder build..."
|
||||
New-Item -Path "Builds/Windows" -Name "placeholder.txt" -ItemType "file" -Value "Windows build placeholder"
|
||||
}
|
||||
|
||||
- name: Set Unreal Engine Path
|
||||
- name: Build for Linux
|
||||
run: |
|
||||
echo "UE_ROOT=F:\LuckyRobots\LuckyRobots\Engine" >> $Env:GITHUB_ENV
|
||||
echo "DOTNET_CLI_HOME=$env:TEMP" >> $Env:GITHUB_ENV
|
||||
echo "MSBUILDDISABLENODEREUSE=1" >> $Env:GITHUB_ENV
|
||||
echo "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1" >> $Env:GITHUB_ENV
|
||||
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $Env:GITHUB_ENV
|
||||
echo "DOTNET_BUILD_OUTPUT_DIR=$env:TEMP\dotnet-build" >> $Env:GITHUB_ENV
|
||||
|
||||
- name: Set up build environment
|
||||
# Execute Linux build script
|
||||
if (Test-Path ./linux_build.sh) {
|
||||
# Use Git Bash to run shell scripts
|
||||
& 'C:\Program Files\Git\bin\bash.exe' -c "./linux_build.sh"
|
||||
} else {
|
||||
echo "Linux build script not found. Creating placeholder build..."
|
||||
New-Item -Path "Builds/Linux" -Name "placeholder.txt" -ItemType "file" -Value "Linux build placeholder"
|
||||
}
|
||||
|
||||
- name: Package builds
|
||||
run: |
|
||||
# Create a custom build output directory in temp
|
||||
$buildRoot = Join-Path $env:TEMP "unreal-build"
|
||||
$dotnetBuildDir = Join-Path $buildRoot "dotnet-build"
|
||||
$buildOutputDir = Join-Path $buildRoot "output"
|
||||
|
||||
# Create directories with full permissions
|
||||
foreach ($dir in @($buildRoot, $dotnetBuildDir, $buildOutputDir)) {
|
||||
New-Item -ItemType Directory -Force -Path $dir
|
||||
icacls $dir /grant Everyone:F /T
|
||||
echo "Packaging Windows build..."
|
||||
if (Test-Path "Builds/Windows") {
|
||||
# Change directory and create zip
|
||||
Push-Location Builds/Windows
|
||||
Compress-Archive -Path .\* -DestinationPath ..\..\PackagedReleases\LuckyRobots-Windows.zip -Force
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
# Set environment variables for build paths
|
||||
echo "DOTNET_BUILD_OUTPUT_DIR=$dotnetBuildDir" >> $Env:GITHUB_ENV
|
||||
echo "DOTNET_CLI_HOME=$dotnetBuildDir" >> $Env:GITHUB_ENV
|
||||
echo "DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1" >> $Env:GITHUB_ENV
|
||||
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $Env:GITHUB_ENV
|
||||
echo "DOTNET_USE_POLLING_FILE_WATCHER=true" >> $Env:GITHUB_ENV
|
||||
echo "MSBUILDDISABLENODEREUSE=1" >> $Env:GITHUB_ENV
|
||||
echo "MSBuildSDKsPath=$env:UE_ROOT\Binaries\ThirdParty\DotNet\8.0.300\win-x64\sdk\8.0.300\Sdks" >> $Env:GITHUB_ENV
|
||||
|
||||
# Clean any existing build artifacts
|
||||
Remove-Item -Path "$dotnetBuildDir\*" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "$buildOutputDir\*" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# Set up global.json to use the correct SDK version
|
||||
$globalJson = @'
|
||||
{
|
||||
"sdk": {
|
||||
"version": "8.0.300",
|
||||
"rollForward": "latestFeature"
|
||||
}
|
||||
echo "Packaging Linux build..."
|
||||
if (Test-Path "Builds/Linux") {
|
||||
# Change directory and create zip
|
||||
Push-Location Builds/Linux
|
||||
Compress-Archive -Path .\* -DestinationPath ..\..\PackagedReleases\LuckyRobots-Linux.zip -Force
|
||||
Pop-Location
|
||||
}
|
||||
'@
|
||||
Set-Content -Path "global.json" -Value $globalJson
|
||||
|
||||
# Create Directory.Build.props to redirect all outputs
|
||||
$buildPropsContent = @'
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<BaseIntermediateOutputPath>$(DOTNET_BUILD_OUTPUT_DIR)\obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
|
||||
<BaseOutputPath>$(DOTNET_BUILD_OUTPUT_DIR)\bin\$(MSBuildProjectName)\</BaseOutputPath>
|
||||
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
|
||||
<OutputPath>$(BaseOutputPath)</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
|
||||
<RestoreNoCache>true</RestoreNoCache>
|
||||
<EnforceWritePermissions>false</EnforceWritePermissions>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
'@
|
||||
Set-Content -Path "Directory.Build.props" -Value $buildPropsContent -Encoding UTF8
|
||||
echo "=== Packaged releases ==="
|
||||
Get-ChildItem -Path PackagedReleases
|
||||
|
||||
- name: Create Tag
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
||||
run: |
|
||||
# Call Git Bash to handle Git operations
|
||||
& 'C:\Program Files\Git\bin\bash.exe' -c "
|
||||
# Fetch all tags
|
||||
git fetch --tags
|
||||
|
||||
# Get the latest version tag, if any
|
||||
LATEST_TAG=\$(git tag -l 'v[0-9]*.[0-9]*.[0-9]*' | sort -V | tail -n1)
|
||||
|
||||
if [ -z \"\$LATEST_TAG\" ]; then
|
||||
# No previous version tag, start with 1.0.0
|
||||
NEW_VERSION=\"1.0.0\"
|
||||
echo \"No previous version tags found, starting with 1.0.0\"
|
||||
else
|
||||
# Strip 'v' prefix if it exists
|
||||
VERSION=\${LATEST_TAG#v}
|
||||
|
||||
# Split version into parts
|
||||
MAJOR=\$(echo \$VERSION | cut -d. -f1)
|
||||
MINOR=\$(echo \$VERSION | cut -d. -f2)
|
||||
PATCH=\$(echo \$VERSION | cut -d. -f3)
|
||||
|
||||
# Auto-increment patch version
|
||||
PATCH=\$((PATCH + 1))
|
||||
NEW_VERSION=\"\${MAJOR}.\${MINOR}.\${PATCH}\"
|
||||
echo \"Auto-incremented patch version from \${VERSION} to \${NEW_VERSION}\"
|
||||
fi
|
||||
|
||||
# Final tag with v prefix
|
||||
TAG=\"v\${NEW_VERSION}\"
|
||||
echo \"Creating git tag: \$TAG\"
|
||||
|
||||
# Configure git with token authentication
|
||||
git config --global user.email \"actions@gitea.com\"
|
||||
git config --global user.name \"Gitea Actions\"
|
||||
|
||||
# Direct token approach - simplest method
|
||||
git remote set-url origin \"https://goran:${{ secrets.GITEATOKEN }}@luckyrobots.com/goran/lyra_game_ue.git\"
|
||||
|
||||
# Set git to not prompt for input
|
||||
export GIT_TERMINAL_PROMPT=0
|
||||
|
||||
# Check if tag exists
|
||||
if ! git rev-parse \"\$TAG\" >/dev/null 2>&1; then
|
||||
# Create tag without opening editor (-m flag)
|
||||
git tag -a \"\$TAG\" -m \"Release \$TAG\"
|
||||
|
||||
# Push with timeout and debug
|
||||
echo \"Pushing tag \$TAG to origin...\"
|
||||
git push --verbose origin \"\$TAG\" || {
|
||||
echo \"Error: Failed to push tag. Check your token permissions.\"
|
||||
exit 1
|
||||
}
|
||||
echo \"Successfully created and pushed tag: \$TAG\"
|
||||
else
|
||||
echo \"Tag \$TAG already exists, skipping tag creation\"
|
||||
fi
|
||||
echo \"RELEASE_TAG=\$TAG\" >> \$GITHUB_ENV
|
||||
"
|
||||
|
||||
# Copy the RELEASE_TAG from Bash environment to PowerShell environment
|
||||
# Read the last tag created
|
||||
$latestTag = & 'C:\Program Files\Git\bin\bash.exe' -c "git tag | sort -V | tail -n1"
|
||||
echo "RELEASE_TAG=$latestTag" >> $env:GITHUB_ENV
|
||||
|
||||
- name: Create Release
|
||||
uses: https://gitea.com/actions/gitea-release-action@main
|
||||
with:
|
||||
files: |-
|
||||
PackagedReleases/*.zip
|
||||
token: '${{ secrets.GITEATOKEN }}'
|
||||
title: 'Release ${{ env.RELEASE_TAG }}'
|
||||
body: |
|
||||
## Automated release from CI build #${{ github.run_number }}
|
||||
|
||||
This release includes builds for:
|
||||
- Windows
|
||||
- Linux
|
||||
|
||||
Built from commit: ${{ github.sha }}
|
||||
prerelease: ${{ github.ref != 'refs/heads/main' }}
|
||||
tag_name: '${{ env.RELEASE_TAG }}'
|
||||
|
||||
macos-build:
|
||||
runs-on: macos
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: false
|
||||
fetch-depth: 0
|
||||
|
||||
# Create a temporary nuget.config file to use a local package cache
|
||||
$nugetConfig = @'
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<config>
|
||||
<add key="globalPackagesFolder" value="$(DOTNET_BUILD_OUTPUT_DIR)\packages" />
|
||||
</config>
|
||||
</configuration>
|
||||
'@
|
||||
Set-Content -Path "nuget.config" -Value $nugetConfig -Encoding UTF8
|
||||
|
||||
# Set MSBuild configuration to use the temp directory
|
||||
$MSBuildPath = Join-Path $env:UE_ROOT "Binaries\ThirdParty\DotNet\8.0.300\win-x64\sdk\8.0.300"
|
||||
$env:MSBuildExtensionsPath = $MSBuildPath
|
||||
$env:MSBuildSDKsPath = Join-Path $MSBuildPath "Sdks"
|
||||
echo "MSBuildExtensionsPath=$env:MSBuildExtensionsPath" >> $Env:GITHUB_ENV
|
||||
echo "MSBuildSDKsPath=$env:MSBuildSDKsPath" >> $Env:GITHUB_ENV
|
||||
echo "MSBUILD_EXE_PATH=$MSBuildPath\MSBuild.dll" >> $Env:GITHUB_ENV
|
||||
|
||||
- name: Locate .uproject file
|
||||
- name: Setup Unreal Engine
|
||||
run: |
|
||||
$projectPath = Get-ChildItem -Path ".\" -Filter "*.uproject" -Recurse | Select-Object -First 1 -ExpandProperty FullName
|
||||
if (-not $projectPath) {
|
||||
Write-Error "No .uproject file found in repository"
|
||||
# Use the correct path where Unreal Engine is installed
|
||||
UE_PATH="/Users/Shared/Epic Games/UE_5.5"
|
||||
|
||||
if [ ! -d "$UE_PATH" ]; then
|
||||
echo "Error: Unreal Engine is not installed in the expected location"
|
||||
echo "Please ensure Unreal Engine is installed at $UE_PATH"
|
||||
exit 1
|
||||
}
|
||||
echo "UPROJECT_PATH=$projectPath" >> $Env:GITHUB_ENV
|
||||
Write-Host "Found project file: $projectPath"
|
||||
|
||||
fi
|
||||
|
||||
# Set environment variable with the correct Engine path
|
||||
echo "UE_ROOT=$UE_PATH/Engine" >> $GITHUB_ENV
|
||||
echo "Using Unreal Engine 5.5"
|
||||
|
||||
- name: Build Unreal Project
|
||||
run: |
|
||||
# Create and set permissions for build output directory
|
||||
$buildOutputDir = Join-Path $env:TEMP "unreal-build\output"
|
||||
New-Item -ItemType Directory -Force -Path $buildOutputDir
|
||||
icacls $buildOutputDir /grant Everyone:F
|
||||
chmod +x ./mac_build.sh
|
||||
./mac_build.sh
|
||||
|
||||
- name: Prepare Mac release
|
||||
run: |
|
||||
echo "Preparing packaged files for release..."
|
||||
|
||||
# Register dotnet locally
|
||||
$dotnetPath = Join-Path $env:UE_ROOT "Binaries\ThirdParty\DotNet\8.0.300\win-x64\dotnet.exe"
|
||||
$env:PATH = "$env:UE_ROOT\Binaries\ThirdParty\DotNet\8.0.300\win-x64;$env:PATH"
|
||||
# Create a directory for release files
|
||||
mkdir -p PackagedReleases
|
||||
|
||||
# Make a local copy of the MSBuild directory with write permissions
|
||||
$customMSBuildDir = Join-Path $env:TEMP "msbuild-custom"
|
||||
New-Item -ItemType Directory -Force -Path $customMSBuildDir
|
||||
Copy-Item -Path "$env:UE_ROOT\Binaries\ThirdParty\DotNet\8.0.300\win-x64\sdk\8.0.300\*" -Destination $customMSBuildDir -Recurse -Force
|
||||
icacls $customMSBuildDir /grant Everyone:F /T
|
||||
# Debug: Show what we're packaging
|
||||
echo "=== Packaging for Release ==="
|
||||
echo "Build directory contents:"
|
||||
ls -la Builds/
|
||||
|
||||
# Set environment variables for the custom MSBuild
|
||||
$env:MSBuildExtensionsPath = $customMSBuildDir
|
||||
$env:MSBuildSDKsPath = Join-Path $customMSBuildDir "Sdks"
|
||||
# Find the app bundle in the Builds directory
|
||||
APP_PATH=$(find Builds -type d -name "*.app" | head -1)
|
||||
|
||||
# Run the build with environment variables
|
||||
$uatPath = Join-Path $env:UE_ROOT "Build\BatchFiles\RunUAT.bat"
|
||||
$envVars = "set DOTNET_CLI_HOME=$env:DOTNET_CLI_HOME && " +
|
||||
"set DOTNET_BUILD_OUTPUT_DIR=$env:DOTNET_BUILD_OUTPUT_DIR && " +
|
||||
"set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 && " +
|
||||
"set DOTNET_CLI_TELEMETRY_OPTOUT=1 && " +
|
||||
"set DOTNET_USE_POLLING_FILE_WATCHER=true && " +
|
||||
"set MSBuildExtensionsPath=$env:MSBuildExtensionsPath && " +
|
||||
"set MSBuildSDKsPath=$env:MSBuildSDKsPath && " +
|
||||
"set MSBUILD_EXE_PATH=$env:MSBUILD_EXE_PATH && "
|
||||
|
||||
# Find project file
|
||||
$projectPath = Get-ChildItem -Path ".\" -Filter "*.uproject" -Recurse | Select-Object -First 1 -ExpandProperty FullName
|
||||
if (-not $projectPath) {
|
||||
Write-Error "No .uproject file found in repository"
|
||||
exit 1
|
||||
}
|
||||
Write-Host "Using project file: $projectPath"
|
||||
if [ -n "$APP_PATH" ]; then
|
||||
echo "Found app bundle: $APP_PATH"
|
||||
# Get the app name
|
||||
APP_NAME=$(basename "$APP_PATH")
|
||||
# Create zip file of the app bundle
|
||||
(cd $(dirname "$APP_PATH") && zip -r "../../PackagedReleases/${APP_NAME%.app}-macOS.zip" "$APP_NAME")
|
||||
echo "Created packaged release: PackagedReleases/${APP_NAME%.app}-macOS.zip"
|
||||
else
|
||||
echo "No .app bundle found in Builds directory"
|
||||
|
||||
# Look for a directory that might be a bundle but not named .app
|
||||
MAIN_BUILD_DIR=$(find Builds -mindepth 1 -maxdepth 1 -type d | head -1)
|
||||
if [ -n "$MAIN_BUILD_DIR" ]; then
|
||||
echo "Found main build directory: $MAIN_BUILD_DIR"
|
||||
DIR_NAME=$(basename "$MAIN_BUILD_DIR")
|
||||
# Package this directory as if it were the app
|
||||
(cd $(dirname "$MAIN_BUILD_DIR") && zip -r "../../PackagedReleases/${DIR_NAME}-macOS.zip" "$DIR_NAME")
|
||||
echo "Created packaged release from main directory: PackagedReleases/${DIR_NAME}-macOS.zip"
|
||||
else
|
||||
# Package the entire Builds directory as a fallback
|
||||
echo "No main directory found, packaging everything"
|
||||
zip -r "PackagedReleases/LuckyRobots-macOS.zip" Builds
|
||||
echo "Created fallback package: PackagedReleases/LuckyRobots-macOS.zip"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run UAT with full command
|
||||
$cmdLine = "$envVars cmd.exe /c `"$uatPath`" BuildCookRun -project=`"$projectPath`" -noP4 -platform=Win64 -clientconfig=Development -cook -build -stage -pak -archive -archivedirectory=`"$buildOutputDir`""
|
||||
Write-Host "Running command: $cmdLine"
|
||||
Invoke-Expression $cmdLine
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
echo "Packaged releases:"
|
||||
ls -la PackagedReleases/
|
||||
|
||||
- name: Create Gitea Release
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
||||
uses: https://gitea.com/actions/gitea-release-action@main
|
||||
with:
|
||||
name: windows-build
|
||||
path: BuildOutput/
|
||||
retention-days: 7
|
||||
|
||||
# macos-build:
|
||||
# runs-on: macos
|
||||
# steps:
|
||||
# - name: Checkout repository
|
||||
# uses: actions/checkout@v3
|
||||
# with:
|
||||
# lfs: true
|
||||
# fetch-depth: 0
|
||||
|
||||
# - name: Setup Unreal Engine
|
||||
# run: |
|
||||
# # Use the correct path where Unreal Engine is installed
|
||||
# UE_PATH="/Users/Shared/Epic Games/UE_5.5"
|
||||
|
||||
# if [ ! -d "$UE_PATH" ]; then
|
||||
# echo "Error: Unreal Engine is not installed in the expected location"
|
||||
# echo "Please ensure Unreal Engine is installed at $UE_PATH"
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
# # Set environment variable with the correct Engine path
|
||||
# echo "UE_ROOT=$UE_PATH/Engine" >> $GITHUB_ENV
|
||||
# echo "Using Unreal Engine 5.5"
|
||||
|
||||
# - name: Build Unreal Project
|
||||
# run: |
|
||||
# # Debug information
|
||||
# echo "=== Environment Information ==="
|
||||
# echo "macOS Version:"
|
||||
# sw_vers
|
||||
# echo "Current working directory: $(pwd)"
|
||||
# ls -la # List all files in current directory
|
||||
|
||||
# echo "=== Unreal Engine Information ==="
|
||||
# ls -la "$UE_ROOT/Build/BatchFiles"
|
||||
|
||||
# echo "=== Project Information ==="
|
||||
# # Detailed search for the project file
|
||||
# echo "Searching for .uproject files:"
|
||||
# find . -name "*.uproject" -type f
|
||||
|
||||
# # Get the absolute path of the project file
|
||||
# UPROJECT_PATH=$(find . -name "*.uproject" -type f | head -1)
|
||||
# if [ -z "$UPROJECT_PATH" ]; then
|
||||
# echo "Error: Could not find .uproject file"
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
# # Convert to absolute path and verify file exists
|
||||
# UPROJECT_ABSOLUTE_PATH=$(realpath "$UPROJECT_PATH")
|
||||
# echo "Project absolute path: $UPROJECT_ABSOLUTE_PATH"
|
||||
|
||||
# if [ ! -f "$UPROJECT_ABSOLUTE_PATH" ]; then
|
||||
# echo "Error: Project file does not exist at: $UPROJECT_ABSOLUTE_PATH"
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
# echo "Using Unreal Engine at: $UE_ROOT"
|
||||
|
||||
# # Make the project file readable and executable
|
||||
# chmod 755 "$UPROJECT_ABSOLUTE_PATH"
|
||||
|
||||
# # Run the build using absolute paths
|
||||
# chmod +x "$UE_ROOT/Build/BatchFiles/RunUAT.sh"
|
||||
# "$UE_ROOT/Build/BatchFiles/RunUAT.sh" BuildCookRun \
|
||||
# -project="$UPROJECT_ABSOLUTE_PATH" \
|
||||
# -noP4 \
|
||||
# -platform=Mac \
|
||||
# -clientconfig=Development \
|
||||
# -cook -build -stage -pak -archive \
|
||||
# -archivedirectory="$(pwd)/Build"
|
||||
|
||||
# - name: Upload build artifacts
|
||||
# uses: actions/upload-artifact@v3
|
||||
# with:
|
||||
# name: macos-build
|
||||
# path: Build/
|
||||
# retention-days: 7
|
||||
token: ${{ secrets.GITEATOKEN }}
|
||||
tag_name: ${{ env.RELEASE_TAG }}
|
||||
title: "Release ${{ env.RELEASE_TAG }}"
|
||||
files: PackagedReleases/*.zip
|
||||
|
93
linux_build.sh
Normal file
93
linux_build.sh
Normal file
@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "======================= Linux Build Script ======================="
|
||||
echo "Running on OS: $OSTYPE"
|
||||
|
||||
# Optional: Check for a Gitea runner-specific environment variable.
|
||||
if [ -z "$GITEA_RUNNER" ]; then
|
||||
echo "Warning: This script does not appear to be running in a Gitea runner environment."
|
||||
fi
|
||||
|
||||
# Get the user's home directory
|
||||
USER_HOME="$HOME"
|
||||
|
||||
# Detect operating system
|
||||
if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" || "$OSTYPE" == "win32" ]]; then
|
||||
echo "Running on Windows - cross-compiling for Linux"
|
||||
IS_WINDOWS=1
|
||||
|
||||
# Set up Unreal Engine paths for Windows (but targeting Linux)
|
||||
UE_ROOT="E:/Games/UE_5.5"
|
||||
UE_EDITOR="$UE_ROOT/Engine/Binaries/Win64/UnrealEditor.exe"
|
||||
UE_UAT="$UE_ROOT/Engine/Build/BatchFiles/RunUAT.bat"
|
||||
|
||||
# Set the Linux toolchain path - this is where it was installed by Chocolatey
|
||||
TOOLCHAIN_PATH="/c/UnrealToolchains/v23_clang-18.1.0-rockylinux8"
|
||||
|
||||
if [ -d "$TOOLCHAIN_PATH" ]; then
|
||||
export LINUX_MULTIARCH_ROOT="$TOOLCHAIN_PATH"
|
||||
echo "Using Linux toolchain at: $LINUX_MULTIARCH_ROOT"
|
||||
else
|
||||
echo "ERROR: Linux toolchain not found at $TOOLCHAIN_PATH!"
|
||||
echo "Please verify the toolchain installation path."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Running on Linux - native compilation"
|
||||
IS_WINDOWS=0
|
||||
|
||||
# Set up Unreal Engine paths for Linux
|
||||
UE_ROOT="/home/runner/UnrealEngine/UE_5.5"
|
||||
UE_EDITOR="$UE_ROOT/Engine/Binaries/Linux/UnrealEditor"
|
||||
UE_UAT="$UE_ROOT/Engine/Build/BatchFiles/RunUAT.sh"
|
||||
|
||||
# Make sure the UAT script is executable (only needed on Linux)
|
||||
chmod +x "$UE_UAT"
|
||||
fi
|
||||
|
||||
# Set up project paths based on the current working directory
|
||||
PROJECT_ROOT="$(pwd)"
|
||||
PROJECT_FILE="$PROJECT_ROOT/Luckyrobots.uproject"
|
||||
ARCHIVE_DIR="$PROJECT_ROOT/Builds/Linux"
|
||||
|
||||
# Create the archive directory if it does not exist
|
||||
mkdir -p "$ARCHIVE_DIR"
|
||||
|
||||
echo "Starting Linux build of Luckyrobots..."
|
||||
echo "Linux toolchain path: $LINUX_MULTIARCH_ROOT"
|
||||
|
||||
# Run the build command using Unreal's Automation Tool (UAT)
|
||||
"$UE_UAT" -ScriptsForProject="$PROJECT_FILE" Turnkey \
|
||||
-command=VerifySdk \
|
||||
-platform=Linux \
|
||||
-UpdateIfNeeded \
|
||||
-EditorIO \
|
||||
-EditorIOPort=59484 \
|
||||
-project="$PROJECT_FILE" \
|
||||
BuildCookRun \
|
||||
-nop4 \
|
||||
-utf8output \
|
||||
-cook \
|
||||
-project="$PROJECT_FILE" \
|
||||
-target=Luckyrobots \
|
||||
-unrealexe="$UE_EDITOR" \
|
||||
-platform=Linux \
|
||||
-installed \
|
||||
-stage \
|
||||
-archive \
|
||||
-package \
|
||||
-build \
|
||||
-iterativecooking \
|
||||
-pak \
|
||||
-iostore \
|
||||
-compressed \
|
||||
-prereqs \
|
||||
-archivedirectory="$ARCHIVE_DIR" \
|
||||
-CrashReporter \
|
||||
-clientconfig=Shipping
|
||||
# Uncomment the following lines if you wish to test the build without pak and iostore:
|
||||
# -skipiostore \
|
||||
# -skippak \
|
||||
|
||||
echo "Linux build completed. Output is in $ARCHIVE_DIR"
|
52
mac_build.sh
Normal file
52
mac_build.sh
Normal file
@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the user's home directory
|
||||
USER_HOME="$HOME"
|
||||
|
||||
# Set up Unreal Engine paths
|
||||
UE_ROOT="/Users/Shared/Epic Games/UE_5.5"
|
||||
UE_EDITOR="$UE_ROOT/Engine/Binaries/Mac/UnrealEditor.app/Contents/MacOS/UnrealEditor"
|
||||
UE_UAT="$UE_ROOT/Engine/Build/BatchFiles/RunUAT.command"
|
||||
|
||||
# Set up project paths
|
||||
PROJECT_ROOT="$(pwd)"
|
||||
PROJECT_FILE="$PROJECT_ROOT/Luckyrobots.uproject"
|
||||
ARCHIVE_DIR="$PROJECT_ROOT/Builds"
|
||||
|
||||
# Run the build command
|
||||
"$UE_UAT" -ScriptsForProject="$PROJECT_FILE" Turnkey \
|
||||
-command=VerifySdk \
|
||||
-platform=Mac \
|
||||
-UpdateIfNeeded \
|
||||
-EditorIO \
|
||||
-EditorIOPort=59484 \
|
||||
-project="$PROJECT_FILE" \
|
||||
BuildCookRun \
|
||||
-nop4 \
|
||||
-utf8output \
|
||||
-cook \
|
||||
-project="$PROJECT_FILE" \
|
||||
-target=Luckyrobots \
|
||||
-unrealexe="$UE_EDITOR" \
|
||||
-platform=Mac \
|
||||
-installed \
|
||||
-stage \
|
||||
-archive \
|
||||
-package \
|
||||
-build \
|
||||
-iterativecooking \
|
||||
-pak \
|
||||
-iostore \
|
||||
-compressed \
|
||||
-prereqs \
|
||||
-archivedirectory="$ARCHIVE_DIR" \
|
||||
-CrashReporter \
|
||||
-clientconfig=Shipping \
|
||||
# -nocompile \
|
||||
# -nocompileuat \
|
||||
# -nocompileeditor \
|
||||
# -skipbuildeditor \
|
||||
|
||||
# enable these if you want to test build without pak and iostore (you're just testing the build)
|
||||
# -skipiostore \
|
||||
# -skippak \ (disable -pak and -iostore)
|
60
win_build.sh
Normal file
60
win_build.sh
Normal file
@ -0,0 +1,60 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Optional: Check for a Gitea runner-specific environment variable.
|
||||
# You can set a variable like GITEA_RUNNER in your runner configuration.
|
||||
if [ -z "$GITEA_RUNNER" ]; then
|
||||
echo "Warning: This script does not appear to be running in a Gitea runner environment."
|
||||
fi
|
||||
|
||||
# Get the user's home directory (if needed)
|
||||
USER_HOME="$HOME"
|
||||
|
||||
# Set up Unreal Engine paths for Windows
|
||||
# Adjust the UE_ROOT path if your installation differs.
|
||||
UE_ROOT="E:/Games/UE_5.5/"
|
||||
UE_EDITOR="$UE_ROOT/Engine/Binaries/Win64/UnrealEditor.exe"
|
||||
UE_UAT="$UE_ROOT/Engine/Build/BatchFiles/RunUAT.bat"
|
||||
|
||||
# Set up project paths based on the current working directory
|
||||
PROJECT_ROOT="$(pwd)"
|
||||
PROJECT_FILE="$PROJECT_ROOT/Luckyrobots.uproject"
|
||||
ARCHIVE_DIR="$PROJECT_ROOT/Builds/Windows"
|
||||
|
||||
# Create the archive directory if it does not exist
|
||||
mkdir -p "$ARCHIVE_DIR"
|
||||
|
||||
echo "Starting Windows build of Luckyrobots via Gitea Runner..."
|
||||
|
||||
# Run the build command using Unreal's Automation Tool (UAT)
|
||||
"$UE_UAT" -ScriptsForProject="$PROJECT_FILE" Turnkey \
|
||||
-command=VerifySdk \
|
||||
-platform=Win64 \
|
||||
-UpdateIfNeeded \
|
||||
-EditorIO \
|
||||
-EditorIOPort=59484 \
|
||||
-project="$PROJECT_FILE" \
|
||||
BuildCookRun \
|
||||
-nop4 \
|
||||
-utf8output \
|
||||
-cook \
|
||||
-project="$PROJECT_FILE" \
|
||||
-target=Luckyrobots \
|
||||
-unrealexe="$UE_EDITOR" \
|
||||
-platform=Win64 \
|
||||
-installed \
|
||||
-stage \
|
||||
-archive \
|
||||
-package \
|
||||
-build \
|
||||
-iterativecooking \
|
||||
-pak \
|
||||
-iostore \
|
||||
-compressed \
|
||||
-prereqs \
|
||||
-archivedirectory="$ARCHIVE_DIR" \
|
||||
-CrashReporter \
|
||||
-clientconfig=Shipping
|
||||
# Uncomment the following lines if you wish to test the build without pak and iostore:
|
||||
# -skipiostore \
|
||||
# -skippak
|
Loading…
x
Reference in New Issue
Block a user