Merge pull request #59 from hzqst/master #18
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: windows | |
on: push | |
env: | |
# Path to the solution file relative to the root of the project. | |
SOLUTION_FILE_PATH: . | |
# Configuration type to build. | |
# You can convert this to a build matrix if you need coverage of multiple configuration types. | |
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
BUILD_CONFIGURATION: Release | |
jobs: | |
build: | |
runs-on: windows-2019 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Get commit hash | |
run: echo "CommitHash=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV | |
- name: Get commit count | |
run: echo "CommitCount=$(git rev-list --count master)" >> $env:GITHUB_ENV | |
- name: Get current date | |
run: echo "CurrentDate=$(date +'%Y-%m-%d')" >> $env:GITHUB_ENV | |
- name: Init dependencies | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: build-initdeps.bat | |
shell: cmd | |
- name: Build MetaAudio.dll | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: build-MetaAudio.bat | |
shell: cmd | |
- name: Create Output directory | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: mkdir Output | |
shell: cmd | |
- name: Copy Build to Output | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
mkdir "Output\${{env.BUILD_CONFIGURATION}}" | |
xcopy "Build\${{env.BUILD_CONFIGURATION}}\MetaAudio.dll" "Output\${{env.BUILD_CONFIGURATION}}" /y /e | |
shell: cmd | |
- name: Copy SteamAppsLocation to Output | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
mkdir "Output\SteamAppsLocation" | |
copy "SteamAppsLocation\SteamAppsLocation.exe" "Output\SteamAppsLocation" /y | |
copy "SteamAppsLocation\steam_appid.txt" "Output\SteamAppsLocation" /y | |
copy "SteamAppsLocation\steam_api.dll" "Output\SteamAppsLocation" /y | |
shell: cmd | |
- name: Copy sndfile to Output | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
xcopy "externals\libsndfile\lib\sndfile.dll" "Output\externals\libsndfile\lib\" /y /e | |
shell: cmd | |
- name: Copy install bat to Output | |
working-directory: ${{env.GITHUB_WORKSPACE}} | |
run: | | |
copy "install-to-OpposingForce.bat" "Output" /y | |
copy "install-to-HalfLife.bat" "Output" /y | |
copy "install-to-DayOfDefeat.bat" "Output" /y | |
copy "install-to-CSCZDeletedScenes.bat" "Output" /y | |
copy "install-to-CounterStrike.bat" "Output" /y | |
copy "install-to-ConditionZero.bat" "Output" /y | |
copy "install-to-BlueShift.bat" "Output" /y | |
shell: cmd | |
- name: Download MetaHook | |
run: | | |
Invoke-WebRequest -Uri https://github.com/hzqst/MetaHookSv/releases/download/v20231124b/MetaHookSv-windows-x86.zip -OutFile MetaHook.zip | |
if (!(Get-FileHash ./MetaHook.zip).Hash.Equals("4B22EA01E0B025CAEABD7301FEF52FA05A807263B8B761760FA3AAD7E1D2EA23")) { | |
Exit -1 | |
} | |
Expand-Archive ./MetaHook.zip -DestinationPath MetaHook/ | |
New-Item -Type dir -Force ./Output/${{env.BUILD_CONFIGURATION}} | |
Copy-Item ./MetaHook/Build/svencoop.exe ./Output/${{env.BUILD_CONFIGURATION}}/metahook.exe | |
shell: pwsh | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: '${{env.CurrentDate}}_MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}' | |
path: Output/ | |
- name: Make Release folder | |
run: mkdir "Release" | |
- name: Compress artifacts | |
uses: papeloto/action-zip@v1 | |
with: | |
files: 'Output/' | |
dest: 'Release/${{env.CurrentDate}}_MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}.zip' | |
- name: Make copy for static download URL | |
run: copy 'Release/${{env.CurrentDate}}_MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}.zip' 'Release/MetaAudio.zip' | |
- name: GitHub pre-release | |
uses: 'marvinpinto/action-automatic-releases@latest' | |
with: | |
repo_token: '${{secrets.GITHUB_TOKEN}}' | |
automatic_release_tag: 'latest' | |
prerelease: true | |
title: '[${{env.CurrentDate}}] MetaAudio-${{env.CommitCount}}@${{env.CommitHash}}' | |
files: "Release/*" |