Skip to content

Tony's PR

Tony's PR #409

Workflow file for this run

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@v3
- 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 list
run: |
Invoke-WebRequest -Uri "https://hitmandb.glaciermodding.org/latest-hashes.7z" -OutFile "latest-hashes.7z"
- 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@v2
- 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/
create_release:
name: Create 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 ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
# TODO: This action is not maintained - migrate to suitable replacement
- name: Create release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: "RPKG ${{ steps.get_version.outputs.VERSION }}"
draft: true
prerelease: ${{ contains(github.ref, '-pre') }}
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
upload_release_asset:
name: Upload release asset
needs: [create_release]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
strategy:
matrix:
artifact: [ "rpkg-cli", "rpkg-lib", "rpkg-gui" ]
steps:
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Format file name
id: file_name
uses: mad9000/actions-find-and-replace-string@2
with:
source: ${{ matrix.artifact }}
find: "rpkg"
replace: "rpkg_${{ steps.get_version.outputs.VERSION }}"
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: ${{ matrix.artifact }}
path: ${{ matrix.artifact }}
- name: Package artifact for release
run: |
cd ${{ matrix.artifact }}
zip -r ${{ matrix.artifact }}.zip *
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ matrix.artifact }}/${{ matrix.artifact }}.zip
asset_name: ${{ steps.file_name.outputs.value }}.zip
asset_content_type: application/zip