diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 000000000..180f7d977 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,171 @@ +name: Release + +on: + push: + branches: + - master + tags: + - 'v*' + +jobs: + build-linux: + name: Build Linux + runs-on: ubuntu-latest + steps: + - name: Checkout source + uses: actions/checkout@v5 + with: + submodules: recursive + + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ runner.os }}-release-ccache + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y build-essential ninja-build ccache uuid-dev + + - name: Configure + run: | + cmake -S . -B build -G Ninja \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DEQEMU_BUILD_LOGIN=ON \ + -DEQEMU_BUILD_LUA=ON \ + -DEQEMU_BUILD_PERL=ON \ + -DEQEMU_BUILD_CLIENT_FILES=ON + + - name: Build + run: cmake --build build --parallel + + - name: Package binaries + run: | + cd build/bin + zip -j eqemu-server-linux-x64.zip \ + world zone ucs queryserv eqlaunch shared_memory \ + loginserver import_client_files export_client_files \ + 2>/dev/null || true + # Include any additional binaries that exist + for f in *; do + if [ -f "$f" ] && [ -x "$f" ] && [ "$f" != "tests" ]; then + zip -u eqemu-server-linux-x64.zip "$f" 2>/dev/null || true + fi + done + ls -la eqemu-server-linux-x64.zip + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: eqemu-server-linux-x64 + path: build/bin/eqemu-server-linux-x64.zip + retention-days: 90 + + build-windows: + name: Build Windows + runs-on: windows-latest + steps: + - name: Checkout source + uses: actions/checkout@v5 + with: + submodules: recursive + + - name: Enable long paths + run: git config --global core.longpaths true + + - name: Setup MSVC environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + - name: Configure + shell: pwsh + run: | + cmake -S . -B build -G "Visual Studio 17 2022" -A x64 ` + -DCMAKE_BUILD_TYPE=RelWithDebInfo ` + -DEQEMU_BUILD_LOGIN=ON ` + -DEQEMU_BUILD_LUA=ON ` + -DEQEMU_BUILD_ZLIB=ON ` + -DEQEMU_BUILD_CLIENT_FILES=ON + + - name: Build + shell: pwsh + run: cmake --build build --config RelWithDebInfo --target ALL_BUILD -- /m + + - name: Package binaries + shell: pwsh + run: | + $binDir = "build/bin/RelWithDebInfo" + $outZip = "eqemu-server-windows-x64.zip" + + # Collect all exe and dll files + $files = @() + + # Add executables (exclude tests.exe) + Get-ChildItem -Path $binDir -Filter "*.exe" | Where-Object { $_.Name -ne "tests.exe" } | ForEach-Object { + $files += $_.FullName + } + + # Add DLLs from bin directory + Get-ChildItem -Path $binDir -Filter "*.dll" -ErrorAction SilentlyContinue | ForEach-Object { + $files += $_.FullName + } + + # Add zlib DLLs if they exist + $zlibDir = "build/libs/zlibng/RelWithDebInfo" + if (Test-Path $zlibDir) { + Get-ChildItem -Path $zlibDir -Filter "*.dll" -ErrorAction SilentlyContinue | ForEach-Object { + $files += $_.FullName + } + } + + # Create zip + Compress-Archive -Path $files -DestinationPath $outZip -Force + + # Show contents + Write-Host "Package contents:" + Get-ChildItem $outZip | Format-List + + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: eqemu-server-windows-x64 + path: eqemu-server-windows-x64.zip + retention-days: 90 + + release: + name: Create Release + needs: [build-linux, build-windows] + runs-on: ubuntu-latest + # Only run on tag pushes + if: startsWith(github.ref, 'refs/tags/v') + permissions: + contents: write + steps: + - name: Download Linux artifact + uses: actions/download-artifact@v4 + with: + name: eqemu-server-linux-x64 + path: artifacts/ + + - name: Download Windows artifact + uses: actions/download-artifact@v4 + with: + name: eqemu-server-windows-x64 + path: artifacts/ + + - name: List artifacts + run: ls -la artifacts/ + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + name: Release ${{ github.ref_name }} + draft: false + prerelease: false + generate_release_notes: true + files: | + artifacts/eqemu-server-linux-x64.zip + artifacts/eqemu-server-windows-x64.zip