feat(workflows): add new build workflows for Windows, Linux, and macOS, and remove obsolete build scripts
Some checks failed
Unreal Engine Build / trigger-builds (push) Has been cancelled
Some checks failed
Unreal Engine Build / trigger-builds (push) Has been cancelled
This commit is contained in:
parent
3cc278081c
commit
dca79841d4
45
.gitea/workflows/build.yml
Normal file
45
.gitea/workflows/build.yml
Normal file
@ -0,0 +1,45 @@
|
||||
name: Unreal Engine Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ozgur/build]
|
||||
|
||||
jobs:
|
||||
trigger-builds:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Trigger Windows Build
|
||||
uses: https://gitea.com/actions/gitea-actions-dispatcher@v0.1.0
|
||||
with:
|
||||
workflow: windows-build.yml
|
||||
token: ${{ secrets.GITEATOKEN }}
|
||||
|
||||
- name: Trigger Linux Build
|
||||
uses: https://gitea.com/actions/gitea-actions-dispatcher@v0.1.0
|
||||
with:
|
||||
workflow: linux-build.yml
|
||||
token: ${{ secrets.GITEATOKEN }}
|
||||
|
||||
- name: Trigger macOS Build
|
||||
uses: https://gitea.com/actions/gitea-actions-dispatcher@v0.1.0
|
||||
with:
|
||||
workflow: macos-build.yml
|
||||
token: ${{ secrets.GITEATOKEN }}
|
||||
|
||||
- name: Wait for builds to complete
|
||||
run: |
|
||||
echo "Waiting for platform builds to complete..."
|
||||
sleep 60 # Adding a delay to ensure builds have time to start
|
||||
|
||||
- name: Trigger Release Creation
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
||||
uses: https://gitea.com/actions/gitea-actions-dispatcher@v0.1.0
|
||||
with:
|
||||
workflow: release.yml
|
||||
token: ${{ secrets.GITEATOKEN }}
|
@ -1,103 +0,0 @@
|
||||
name: Unreal Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
windows_build_path:
|
||||
description: 'Absolute path to the Windows build zip file'
|
||||
required: true
|
||||
default: 'E:\LuckyWorld\LuckyRobots\UNREAL_PROJECTS\Luckyrobots\Builds\Windows\LuckyRobots-Windows.zip'
|
||||
linux_build_path:
|
||||
description: 'Absolute path to the Linux build zip file'
|
||||
required: true
|
||||
default: 'E:\LuckyWorld\LuckyRobots\UNREAL_PROJECTS\Luckyrobots\Builds\Linux\LuckyRobots-Linux.zip'
|
||||
mac_build_path:
|
||||
description: 'Absolute path to the Mac build zip file'
|
||||
required: true
|
||||
default: 'E:\LuckyWorld\LuckyRobots\UNREAL_PROJECTS\Luckyrobots\Builds\Mac\LuckyRobots-Mac.zip'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows
|
||||
steps:
|
||||
- name: Upload Linux Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: LuckyRobots-Linux
|
||||
path: ${{ github.event.inputs.linux_build_path }}
|
||||
retention-days: 365
|
||||
|
||||
- name: Upload Windows Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: LuckyRobots-Windows
|
||||
path: ${{ github.event.inputs.windows_build_path }}
|
||||
retention-days: 365
|
||||
|
||||
- name: Upload Mac Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: LuckyRobots-Mac
|
||||
path: ${{ github.event.inputs.mac_build_path }}
|
||||
retention-days: 365
|
||||
|
||||
- name: Get Release Tag
|
||||
shell: pwsh
|
||||
run: |
|
||||
# Fetch all tags
|
||||
git fetch --tags
|
||||
|
||||
# Get the latest version tag, if any
|
||||
# Uses Sort-Object with a version comparison scriptblock
|
||||
$latestTag = git tag -l "v[0-9]*.[0-9]*.[0-9]*" | Sort-Object -Property @{Expression={[version]($_ -replace 'v')}} | Select-Object -Last 1
|
||||
|
||||
$newVersion = "1.0.0" # Default start version
|
||||
|
||||
if ($null -ne $latestTag -and $latestTag -ne '') {
|
||||
Write-Host "Latest tag found: $latestTag"
|
||||
# Strip 'v' prefix
|
||||
$versionString = $latestTag -replace '^v'
|
||||
|
||||
# Split version into parts
|
||||
$versionParts = $versionString.Split('.')
|
||||
if ($versionParts.Length -eq 3) {
|
||||
$major = [int]$versionParts[0]
|
||||
$minor = [int]$versionParts[1]
|
||||
$patch = [int]$versionParts[2]
|
||||
|
||||
# Auto-increment patch version
|
||||
$patch++
|
||||
$newVersion = "$major.$minor.$patch"
|
||||
Write-Host "Auto-incremented patch version from $versionString to $newVersion"
|
||||
} else {
|
||||
Write-Host "Could not parse version from tag: $latestTag. Defaulting to 1.0.0"
|
||||
}
|
||||
} else {
|
||||
Write-Host "No previous version tags found, starting with 1.0.0"
|
||||
}
|
||||
|
||||
# Final tag with v prefix
|
||||
$tag = "v$newVersion"
|
||||
|
||||
# Set environment variable for subsequent steps
|
||||
echo "RELEASE_TAG=$tag" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
Write-Host "Using release tag: $tag"
|
||||
|
||||
- name: Create Release
|
||||
uses: https://gitea.com/actions/gitea-release-action@main
|
||||
with:
|
||||
token: '${{ secrets.GITEA_TOKEN }}'
|
||||
title: 'Release ${{ env.RELEASE_TAG }}'
|
||||
body: |
|
||||
## LuckyRobots Game Release ${{ env.RELEASE_TAG }}
|
||||
|
||||
Windows, Linux and Mac builds are attached below.
|
||||
|
||||
### Build Information
|
||||
|
||||
- Build Number: #${{ github.run_number }}
|
||||
- Commit: ${{ github.sha }}
|
||||
- Branch: ${{ github.ref_name }}
|
||||
- Build Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
|
||||
prerelease: ${{ github.ref != 'refs/heads/main' }}
|
||||
tag_name: '${{ env.RELEASE_TAG }}'
|
53
.gitea/workflows/linux-build.yml
Normal file
53
.gitea/workflows/linux-build.yml
Normal file
@ -0,0 +1,53 @@
|
||||
name: Linux Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
linux-build:
|
||||
runs-on: windows
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup environment
|
||||
run: |
|
||||
# Set environment variables for Unreal Engine
|
||||
echo "UE_ROOT=E:/Games/UE_5.5" >> $GITHUB_ENV
|
||||
|
||||
# Set environment variables for Linux toolchain (needed for cross-compilation)
|
||||
$env:LINUX_MULTIARCH_ROOT="C:/UnrealToolchains/v23_clang-18.1.0-rockylinux8"
|
||||
echo "LINUX_MULTIARCH_ROOT=${LINUX_MULTIARCH_ROOT}" >> $GITHUB_ENV
|
||||
|
||||
# Create directories for builds
|
||||
if (!(Test-Path "Builds/Linux")) { New-Item -ItemType Directory -Path "Builds/Linux" -Force }
|
||||
if (!(Test-Path "PackagedReleases")) { New-Item -ItemType Directory -Path "PackagedReleases" -Force }
|
||||
|
||||
- name: Build for Linux
|
||||
run: |
|
||||
# Chmod command doesn't exist in Windows, use PowerShell to run the bash script
|
||||
& 'C:\Program Files\Git\bin\bash.exe' -c "./scripts/linux_build.sh"
|
||||
|
||||
- name: Package Linux build
|
||||
run: |
|
||||
echo "Packaging Linux build..."
|
||||
if [ -d "Builds/Linux" ]; then
|
||||
cd Builds/Linux
|
||||
zip -r ../../PackagedReleases/LuckyRobots-Linux.zip .
|
||||
cd ../..
|
||||
fi
|
||||
|
||||
echo "=== Packaged Linux release ==="
|
||||
ls -la PackagedReleases/
|
||||
|
||||
- name: Upload Linux Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success() && hashFiles('PackagedReleases/LuckyRobots-Linux.zip') != ''
|
||||
with:
|
||||
name: LuckyRobots-Linux
|
||||
path: PackagedReleases/LuckyRobots-Linux.zip
|
||||
retention-days: 365
|
81
.gitea/workflows/macos-build.yml
Normal file
81
.gitea/workflows/macos-build.yml
Normal file
@ -0,0 +1,81 @@
|
||||
name: macOS Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
macos-build:
|
||||
runs-on: macos
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup environment
|
||||
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
|
||||
|
||||
# Create directories for builds
|
||||
mkdir -p Builds/Mac
|
||||
mkdir -p PackagedReleases
|
||||
|
||||
echo "Using Unreal Engine 5.5"
|
||||
|
||||
- name: Build for macOS
|
||||
run: |
|
||||
chmod +x ./scripts/mac_build.sh
|
||||
./scripts/mac_build.sh
|
||||
|
||||
- name: Package macOS build
|
||||
run: |
|
||||
echo "Preparing packaged files for release..."
|
||||
|
||||
# Find the app bundle in the Builds directory
|
||||
APP_PATH=$(find Builds -type d -name "*.app" | head -1)
|
||||
|
||||
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/LuckyRobots-macOS.zip" "$APP_NAME")
|
||||
echo "Created packaged release: PackagedReleases/LuckyRobots-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/LuckyRobots-macOS.zip" "$DIR_NAME")
|
||||
echo "Created packaged release from main directory: PackagedReleases/LuckyRobots-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
|
||||
|
||||
echo "Packaged releases:"
|
||||
ls -la PackagedReleases/
|
||||
|
||||
- name: Upload macOS Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success()
|
||||
with:
|
||||
name: LuckyRobots-macOS
|
||||
path: PackagedReleases/LuckyRobots-macOS.zip
|
||||
retention-days: 365
|
163
.gitea/workflows/release.yml
Normal file
163
.gitea/workflows/release.yml
Normal file
@ -0,0 +1,163 @@
|
||||
name: Create Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Create Tag
|
||||
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 [ -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
|
||||
git remote set-url origin "https://runner:${{ secrets.GITEATOKEN }}@luckyrobots.com/luckyrobots/luckyworld.git"
|
||||
|
||||
# Check if tag exists
|
||||
if ! git rev-parse "$TAG" >/dev/null 2>&1; then
|
||||
# Create tag
|
||||
git tag -a "$TAG" -m "Release $TAG"
|
||||
|
||||
# Push tag
|
||||
git push origin "$TAG"
|
||||
echo "Successfully created and pushed tag: $TAG"
|
||||
else
|
||||
echo "Tag $TAG already exists, skipping tag creation"
|
||||
fi
|
||||
echo "RELEASE_TAG=$TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
path: releases
|
||||
|
||||
- name: Create Build Info
|
||||
run: |
|
||||
# Create a build info JSON file
|
||||
echo '{
|
||||
"version": "${{ env.RELEASE_TAG }}",
|
||||
"buildNumber": "${{ github.run_number }}",
|
||||
"commit": "${{ github.sha }}",
|
||||
"branch": "${{ github.ref_name }}",
|
||||
"buildDate": "'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'",
|
||||
"artifacts": {
|
||||
"windows": "https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Windows",
|
||||
"linux": "https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Linux",
|
||||
"macos": "https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-macOS"
|
||||
}
|
||||
}' > build-info.json
|
||||
|
||||
# Create a simple HTML download page
|
||||
echo '<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LuckyRobots ${{ env.RELEASE_TAG }} Downloads</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; }
|
||||
h1 { color: #333; }
|
||||
.download-btn {
|
||||
display: inline-block;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
text-decoration: none;
|
||||
border-radius: 4px;
|
||||
margin: 10px 5px;
|
||||
}
|
||||
.download-btn:hover { background-color: #45a049; }
|
||||
.platform { margin-bottom: 30px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>LuckyRobots Game - ${{ env.RELEASE_TAG }}</h1>
|
||||
<p>Build #${{ github.run_number }} - Built from commit: ${{ github.sha }}</p>
|
||||
|
||||
<div class="platform">
|
||||
<h2>Windows</h2>
|
||||
<p><a href="https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Windows" class="download-btn">Download Windows Build</a></p>
|
||||
</div>
|
||||
|
||||
<div class="platform">
|
||||
<h2>Linux</h2>
|
||||
<p><a href="https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Linux" class="download-btn">Download Linux Build</a></p>
|
||||
</div>
|
||||
|
||||
<div class="platform">
|
||||
<h2>macOS</h2>
|
||||
<p><a href="https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-macOS" class="download-btn">Download macOS Build</a></p>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<p>Generated on '$(date -u +"%Y-%m-%d %H:%M:%S UTC")'</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>' > downloads.html
|
||||
|
||||
- name: Create Release
|
||||
uses: https://gitea.com/actions/gitea-release-action@main
|
||||
with:
|
||||
files: |-
|
||||
build-info.json
|
||||
downloads.html
|
||||
token: '${{ secrets.GITEATOKEN }}'
|
||||
title: 'Release ${{ env.RELEASE_TAG }}'
|
||||
body: |
|
||||
## LuckyRobots Game Release ${{ env.RELEASE_TAG }}
|
||||
|
||||
### Download Links
|
||||
|
||||
Download builds from our CI artifacts:
|
||||
|
||||
- [Windows Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Windows)
|
||||
- [Linux Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Linux)
|
||||
- [macOS Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-macOS)
|
||||
|
||||
### Build Information
|
||||
|
||||
- Build Number: #${{ github.run_number }}
|
||||
- Commit: ${{ github.sha }}
|
||||
- Branch: ${{ github.ref_name }}
|
||||
- Build Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
|
||||
prerelease: ${{ github.ref != 'refs/heads/main' }}
|
||||
tag_name: '${{ env.RELEASE_TAG }}'
|
@ -1,347 +0,0 @@
|
||||
name: Unreal Engine Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
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
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup environment
|
||||
run: |
|
||||
# Set environment variables for Unreal Engine
|
||||
echo "UE_ROOT=E:/Games/UE_5.5" >> $GITHUB_ENV
|
||||
# Set environment variables for Linux toolchain
|
||||
$env:LINUX_MULTIARCH_ROOT="C:/UnrealToolchains/v23_clang-18.1.0-rockylinux8"
|
||||
echo "LINUX_MULTIARCH_ROOT=${LINUX_MULTIARCH_ROOT}" >> $GITHUB_ENV
|
||||
|
||||
# Create directories for builds (with error handling)
|
||||
if (!(Test-Path "Builds/Windows")) { New-Item -ItemType Directory -Path "Builds/Windows" -Force }
|
||||
if (!(Test-Path "Builds/Linux")) { New-Item -ItemType Directory -Path "Builds/Linux" -Force }
|
||||
if (!(Test-Path "PackagedReleases")) { New-Item -ItemType Directory -Path "PackagedReleases" -Force }
|
||||
|
||||
- name: Build for Windows
|
||||
run: |
|
||||
# Chmod command doesn't exist in Windows, use PowerShell to run the bash script
|
||||
& 'C:\Program Files\Git\bin\bash.exe' -c "./win_build.sh"
|
||||
|
||||
- name: Build for Linux
|
||||
run: |
|
||||
# Chmod command doesn't exist in Windows, use PowerShell to run the bash script
|
||||
& 'C:\Program Files\Git\bin\bash.exe' -c "./linux_build.sh"
|
||||
|
||||
- name: Package builds
|
||||
run: |
|
||||
echo "Packaging Windows build..."
|
||||
if [ -d "Builds/Windows" ]; then
|
||||
cd Builds/Windows
|
||||
zip -r ../../PackagedReleases/LuckyRobots-Windows.zip .
|
||||
cd ../..
|
||||
fi
|
||||
|
||||
echo "Packaging Linux build..."
|
||||
if [ -d "Builds/Linux" ]; then
|
||||
cd Builds/Linux
|
||||
zip -r ../../PackagedReleases/LuckyRobots-Linux.zip .
|
||||
cd ../..
|
||||
fi
|
||||
|
||||
echo "=== Packaged releases ==="
|
||||
ls -la PackagedReleases/
|
||||
|
||||
- name: Upload Windows Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success() && hashFiles('PackagedReleases/LuckyRobots-Windows.zip') != ''
|
||||
with:
|
||||
name: LuckyRobots-Windows
|
||||
path: PackagedReleases/LuckyRobots-Windows.zip
|
||||
retention-days: 365
|
||||
|
||||
- name: Upload Linux Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success() && hashFiles('PackagedReleases/LuckyRobots-Linux.zip') != ''
|
||||
with:
|
||||
name: LuckyRobots-Linux
|
||||
path: PackagedReleases/LuckyRobots-Linux.zip
|
||||
retention-days: 365
|
||||
|
||||
- name: Create Tag
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
||||
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 [ -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/luckyrobots/luckyworld.git"
|
||||
|
||||
# Set git to not prompt for input
|
||||
$env: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 Build Info
|
||||
run: |
|
||||
# Create a build info JSON file
|
||||
echo '{
|
||||
"version": "${{ env.RELEASE_TAG }}",
|
||||
"buildNumber": "${{ github.run_number }}",
|
||||
"commit": "${{ github.sha }}",
|
||||
"branch": "${{ github.ref_name }}",
|
||||
"buildDate": "'$(date -u +"%Y-%m-%dT%H:%M:%SZ")'",
|
||||
"artifacts": {
|
||||
"windows": "https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Windows",
|
||||
"linux": "https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Linux"
|
||||
}
|
||||
}' > PackagedReleases/build-info.json
|
||||
|
||||
# Create a simple HTML download page
|
||||
echo '<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>LuckyRobots ${{ env.RELEASE_TAG }} Downloads</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; }
|
||||
h1 { color: #333; }
|
||||
.download-btn {
|
||||
display: inline-block;
|
||||
background-color: #4CAF50;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
text-decoration: none;
|
||||
border-radius: 4px;
|
||||
margin: 10px 5px;
|
||||
}
|
||||
.download-btn:hover { background-color: #45a049; }
|
||||
.platform { margin-bottom: 30px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>LuckyRobots Game - ${{ env.RELEASE_TAG }}</h1>
|
||||
<p>Build #${{ github.run_number }} - Built from commit: ${{ github.sha }}</p>
|
||||
|
||||
<div class="platform">
|
||||
<h2>Windows</h2>
|
||||
<p><a href="https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Windows" class="download-btn">Download Windows Build</a></p>
|
||||
</div>
|
||||
|
||||
<div class="platform">
|
||||
<h2>Linux</h2>
|
||||
<p><a href="https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Linux" class="download-btn">Download Linux Build</a></p>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
<p>Generated on '$(date -u +"%Y-%m-%d %H:%M:%S UTC")'</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>' > PackagedReleases/downloads.html
|
||||
|
||||
- name: Create Release
|
||||
uses: https://gitea.com/actions/gitea-release-action@main
|
||||
with:
|
||||
files: |-
|
||||
PackagedReleases/build-info.json
|
||||
PackagedReleases/downloads.html
|
||||
token: '${{ secrets.GITEA_TOKEN }}'
|
||||
title: 'Release ${{ env.RELEASE_TAG }}'
|
||||
body: |
|
||||
## LuckyRobots Game Release ${{ env.RELEASE_TAG }}
|
||||
|
||||
### Download Links
|
||||
|
||||
Download builds from our CI artifacts:
|
||||
|
||||
- [Windows Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Windows)
|
||||
- [Linux Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-Linux)
|
||||
|
||||
### Build Information
|
||||
|
||||
- Build Number: #${{ github.run_number }}
|
||||
- Commit: ${{ github.sha }}
|
||||
- Branch: ${{ github.ref_name }}
|
||||
- Build Date: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
|
||||
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: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get Release Tag
|
||||
run: |
|
||||
# Fetch all tags
|
||||
git fetch --tags
|
||||
|
||||
# Get the latest version tag
|
||||
LATEST_TAG=$(git tag -l "v[0-9]*.[0-9]*.[0-9]*" | sort -V | tail -n1)
|
||||
|
||||
if [ -z "$LATEST_TAG" ]; then
|
||||
NEW_VERSION="1.0.0"
|
||||
else
|
||||
VERSION=${LATEST_TAG#v}
|
||||
MAJOR=$(echo $VERSION | cut -d. -f1)
|
||||
MINOR=$(echo $VERSION | cut -d. -f2)
|
||||
PATCH=$(echo $VERSION | cut -d. -f3)
|
||||
PATCH=$((PATCH + 1))
|
||||
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
||||
fi
|
||||
|
||||
TAG="v${NEW_VERSION}"
|
||||
echo "RELEASE_TAG=$TAG" >> $GITHUB_ENV
|
||||
echo "Using release tag: $TAG"
|
||||
|
||||
- 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: |
|
||||
chmod +x ./mac_build.sh
|
||||
./mac_build.sh
|
||||
|
||||
- name: Prepare Mac release
|
||||
run: |
|
||||
echo "Preparing packaged files for release..."
|
||||
|
||||
# Create a directory for release files
|
||||
mkdir -p PackagedReleases
|
||||
|
||||
# Debug: Show what we're packaging
|
||||
echo "=== Packaging for Release ==="
|
||||
echo "Build directory contents:"
|
||||
ls -la Builds/
|
||||
|
||||
# Find the app bundle in the Builds directory
|
||||
APP_PATH=$(find Builds -type d -name "*.app" | head -1)
|
||||
|
||||
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
|
||||
|
||||
echo "Packaged releases:"
|
||||
ls -la PackagedReleases/
|
||||
|
||||
- name: Upload macOS Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success()
|
||||
with:
|
||||
name: LuckyRobots-macOS
|
||||
path: PackagedReleases/*-macOS.zip
|
||||
retention-days: 365
|
||||
|
||||
- name: Create Release Note
|
||||
run: |
|
||||
echo "## macOS Build Completed" > release-note.md
|
||||
echo "" >> release-note.md
|
||||
echo "macOS build is available as an artifact." >> release-note.md
|
||||
echo "" >> release-note.md
|
||||
echo "Download from: [macOS Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-macOS)" >> release-note.md
|
||||
|
||||
- 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 }} - macOS"
|
||||
body: |
|
||||
## macOS Build Available as Artifact
|
||||
|
||||
The macOS build is available as an artifact due to its large file size.
|
||||
|
||||
[Download macOS Build](https://luckyrobots.com/luckyrobots/luckyworld/actions/runs/${{ github.run_id }}/artifacts/LuckyRobots-macOS)
|
||||
|
||||
Built from commit: ${{ github.sha }}
|
||||
files: release-note.md
|
49
.gitea/workflows/windows-build.yml
Normal file
49
.gitea/workflows/windows-build.yml
Normal file
@ -0,0 +1,49 @@
|
||||
name: Windows Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
windows-build:
|
||||
runs-on: windows
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup environment
|
||||
run: |
|
||||
# Set environment variables for Unreal Engine
|
||||
echo "UE_ROOT=E:/Games/UE_5.5" >> $GITHUB_ENV
|
||||
|
||||
# Create directories for builds
|
||||
if (!(Test-Path "Builds/Windows")) { New-Item -ItemType Directory -Path "Builds/Windows" -Force }
|
||||
if (!(Test-Path "PackagedReleases")) { New-Item -ItemType Directory -Path "PackagedReleases" -Force }
|
||||
|
||||
- name: Build for Windows
|
||||
run: |
|
||||
# Chmod command doesn't exist in Windows, use PowerShell to run the bash script
|
||||
& 'C:\Program Files\Git\bin\bash.exe' -c "./scripts/win_build.sh"
|
||||
|
||||
- name: Package Windows build
|
||||
run: |
|
||||
echo "Packaging Windows build..."
|
||||
if [ -d "Builds/Windows" ]; then
|
||||
cd Builds/Windows
|
||||
zip -r ../../PackagedReleases/LuckyRobots-Windows.zip .
|
||||
cd ../..
|
||||
fi
|
||||
|
||||
echo "=== Packaged Windows release ==="
|
||||
ls -la PackagedReleases/
|
||||
|
||||
- name: Upload Windows Build Artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
if: success() && hashFiles('PackagedReleases/LuckyRobots-Windows.zip') != ''
|
||||
with:
|
||||
name: LuckyRobots-Windows
|
||||
path: PackagedReleases/LuckyRobots-Windows.zip
|
||||
retention-days: 365
|
Loading…
x
Reference in New Issue
Block a user