Merge pull request #95 from glacier-modding/tt-1-8-2 #449
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
- rewrite | |
tags: | |
- v* | |
pull_request: | |
types: [ opened, synchronize, reopened ] | |
workflow_dispatch: | |
jobs: | |
build_windows: | |
name: Build (Windows) | |
runs-on: ptlm-runner | |
strategy: | |
matrix: | |
target: [rpkg-cli, rpkg-lib] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup VS environment | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x64 | |
- name: Generate projects | |
run: | | |
mkdir cmake-build-release | |
cd cmake-build-release | |
cmake -G Ninja ` | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo ` | |
-DCMAKE_CXX_COMPILER=cl ` | |
-DCMAKE_C_COMPILER=cl ` | |
.. | |
- name: Build | |
run: | | |
cmake --build cmake-build-release --target ${{ matrix.target }} | |
- name: Fetch hash lists | |
run: | | |
mkdir _rpkg | |
Invoke-WebRequest -Uri "https://github.com/glacier-modding/Hitman-Hashes/releases/latest/download/latest-hashes.7z" -OutFile "latest-hashes.7z" | |
Invoke-WebRequest -Uri "https://github.com/glacier-modding/Hitman-l10n-Hashes/releases/latest/download/hash_list.hmla" -OutFile "_rpkg/hash_list.hmla" | |
- name: Prepare build | |
run: | | |
7z e latest-hashes.7z -o_rpkg | |
cp cmake-build-release/*.dll _rpkg | |
cp cmake-build-release/*.exe _rpkg | |
cp cmake-build-release/rpkg*.lib _rpkg | |
cp thirdparty/quickentity-ffi/*.dll _rpkg | |
cp thirdparty/assimp/*.dll _rpkg | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.target }} | |
path: _rpkg | |
build_gui: | |
name: "Build GUI" | |
needs: [build_windows] | |
runs-on: ptlm-runner | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v1.1.3 | |
with: | |
msbuild-architecture: x64 | |
- name: Restore NuGet packages | |
run: cd rpkg-gui && nuget restore rpkg.sln | |
- name: Download rpkg-lib | |
uses: actions/download-artifact@v3 | |
with: | |
name: rpkg-lib | |
path: cmake-build-release | |
- name: Build | |
run: | | |
cd rpkg-gui && msbuild /m /p:Configuration=Release /p:Platform=x64 rpkg.sln | |
- name: Upload GUI artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: rpkg-gui | |
path: | | |
_build/Release | |
!_build/Release/*.pdb | |
!_build/Release/rpkg.exe.config | |
!_build/Release/runtimes/ | |
release: | |
name: Release | |
needs: [build_windows, build_gui] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
- name: Package artifacts for release | |
run: | | |
(cd rpkg-cli && zip -r ../rpkg_${{ env.VERSION }}-cli.zip .) | |
(cd rpkg-lib && zip -r ../rpkg_${{ env.VERSION }}-lib.zip .) | |
(cd rpkg-gui && zip -r ../rpkg_${{ env.VERSION }}-gui.zip .) | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
rpkg_${{ env.VERSION }}-cli.zip | |
rpkg_${{ env.VERSION }}-lib.zip | |
rpkg_${{ env.VERSION }}-gui.zip | |
tag_name: ${{ env.VERSION }} | |
name: RPKG ${{ env.VERSION }} | |
draft: false | |
prerelease: ${{ contains(github.ref, '-pre') }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
trigger_website_build: | |
needs: release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger glaciermodding.org build | |
uses: peter-evans/repository-dispatch@v2 | |
with: | |
token: ${{ secrets.ACTIONS_KEY }} | |
repository: glacier-modding/glaciermodding.org | |
event-type: build_site |