Files
UnlockedByDaylight/.github/workflows/build.yml
T
neru 4197b4f52e
Build / build (push) Failing after 1m7s
build: add semantic versioning
2026-03-20 23:03:19 -03:00

105 lines
3.4 KiB
YAML

name: Build
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
fetch-tags: true
- name: Configure version information
id: calculate-version
if: ${{ github.event_name == 'push' }}
uses: bitshifted/git-auto-semver@v2
with:
create_tag: true
initial_version: 0.2.0
- name: Setup Tools Cache
id: tools-cache
uses: actions/cache@v4
with:
path: |
cmake-3.30.5-linux-x86_64
ccache
key: ${{ runner.os }}-tools-${{ hashFiles('**/CMakeLists.txt') }}
- name: Install tools
run: |
sudo apt-get update
sudo apt-get install -y mingw-w64 zstd ccache zip
mkdir -p ccache
echo "CCACHE_DIR=$GITHUB_WORKSPACE/ccache" >> $GITHUB_ENV
- name: Install CMake 3.30
if: steps.tools-cache.outputs.cache-hit != 'true'
run: |
wget -q https://github.com/Kitware/CMake/releases/download/v3.30.5/cmake-3.30.5-linux-x86_64.tar.gz
tar xzf cmake-3.30.5-linux-x86_64.tar.gz
- name: Add CMake to path
run: echo "$GITHUB_WORKSPACE/cmake-3.30.5-linux-x86_64/bin" >> $GITHUB_PATH
- name: Get OpenSSL for MinGW (pre-built from MSYS2)
run: |
if [ ! -d "/usr/x86_64-w64-mingw32/include/openssl" ]; then
wget -q "https://repo.msys2.org/mingw/mingw64/mingw-w64-x86_64-openssl-3.3.2-1-any.pkg.tar.zst"
tar xf mingw-w64-x86_64-openssl-3.3.2-1-any.pkg.tar.zst
sudo cp -r mingw64/include/openssl /usr/x86_64-w64-mingw32/include/
sudo cp mingw64/lib/libssl.a mingw64/lib/libcrypto.a /usr/x86_64-w64-mingw32/lib/
fi
- name: Patch missing MinGW headers
run: |
[ -f /usr/x86_64-w64-mingw32/include/consoleapi.h ] || \
printf '#pragma once\n#include <windows.h>\n' | \
sudo tee /usr/x86_64-w64-mingw32/include/consoleapi.h > /dev/null
- name: Configure CMake
run: |
cmake -B build -S . \
-DCMAKE_SYSTEM_NAME=Windows \
-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc \
-DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ \
-DCMAKE_RC_COMPILER=x86_64-w64-mingw32-windres \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DOPENSSL_ROOT_DIR=/usr/x86_64-w64-mingw32 \
-DOPENSSL_INCLUDE_DIR=/usr/x86_64-w64-mingw32/include \
-DOPENSSL_LIBRARIES="/usr/x86_64-w64-mingw32/lib/libssl.a;/usr/x86_64-w64-mingw32/lib/libcrypto.a"
- name: Build Unlocker
run: cmake --build build --target dbd-unlocker
- name: Package Build
run: |
EXE=$(find build -name "*.exe" | head -1)
mkdir -p release
cp "$EXE" release/
cp res/*.json release/
cd release && zip -j ../unlocker.zip *
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: unlocker-build
path: unlocker.zip
- name: Create Gitea Release
if: ${{ github.event_name == 'push' }}
uses: akkuman/gitea-release-action@v1
with:
files: unlocker.zip
tag_name: v${{ steps.calculate-version.outputs.version-string }}
name: Release v${{ steps.calculate-version.outputs.version-string }}