Initial release: SDL Windows Tetris
This commit is contained in:
114
.github/workflows/build.yml
vendored
Normal file
114
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,114 @@
|
||||
name: Build and Package Tetris
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
tags: [ 'v*' ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup vcpkg
|
||||
uses: lukka/run-vcpkg@v11
|
||||
with:
|
||||
vcpkgGitCommitId: 'latest'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
vcpkg install sdl3 sdl3-image sdl3-ttf --triplet=x64-windows
|
||||
|
||||
- name: Configure CMake
|
||||
run: |
|
||||
cmake -B build -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --config Release
|
||||
|
||||
- name: Package
|
||||
run: cmake --build build --target package
|
||||
|
||||
- name: Create distribution package
|
||||
run: |
|
||||
mkdir dist
|
||||
powershell -ExecutionPolicy Bypass -File build-production.ps1 -PackageOnly -OutputDir dist
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: tetris-windows-x64
|
||||
path: dist/TetrisGame/
|
||||
|
||||
- name: Create Release ZIP
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
cd dist
|
||||
7z a ../TetrisGame-Windows-x64.zip TetrisGame/
|
||||
|
||||
- name: Release
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: TetrisGame-Windows-x64.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y cmake build-essential
|
||||
# Install SDL3 from source or package manager
|
||||
# This may need adjustment based on SDL3 availability
|
||||
|
||||
- name: Configure CMake
|
||||
run: cmake -B build -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build
|
||||
|
||||
- name: Package
|
||||
run: |
|
||||
mkdir -p dist/TetrisGame-Linux
|
||||
cp build/tetris dist/TetrisGame-Linux/
|
||||
cp -r assets dist/TetrisGame-Linux/
|
||||
cp FreeSans.ttf dist/TetrisGame-Linux/
|
||||
echo '#!/bin/bash' > dist/TetrisGame-Linux/launch-tetris.sh
|
||||
echo 'cd "$(dirname "$0")"' >> dist/TetrisGame-Linux/launch-tetris.sh
|
||||
echo './tetris' >> dist/TetrisGame-Linux/launch-tetris.sh
|
||||
chmod +x dist/TetrisGame-Linux/launch-tetris.sh
|
||||
chmod +x dist/TetrisGame-Linux/tetris
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: tetris-linux-x64
|
||||
path: dist/TetrisGame-Linux/
|
||||
|
||||
- name: Create Release TAR
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
run: |
|
||||
cd dist
|
||||
tar -czf ../TetrisGame-Linux-x64.tar.gz TetrisGame-Linux/
|
||||
|
||||
- name: Release
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: TetrisGame-Linux-x64.tar.gz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user