2021-11-05 03:46:14 +01:00
|
|
|
# references:
|
|
|
|
# https://trstringer.com/github-actions-multiline-strings/
|
|
|
|
# https://trstringer.com/github-actions-create-release-upload-artifacts/
|
|
|
|
# https://github.com/Speedy37/sws/blob/444c67157a98652c4e7ffd3b6d6bbfb664071926/.github/workflows/msbuild.yml
|
|
|
|
# https://stackoverflow.com/questions/58886293/getting-current-branch-and-commit-hash-in-github-action
|
|
|
|
|
2021-11-05 00:37:09 +01:00
|
|
|
name: Build
|
|
|
|
|
2021-11-05 05:16:04 +01:00
|
|
|
on: [push, pull_request]
|
2021-11-05 00:37:09 +01:00
|
|
|
|
|
|
|
env:
|
|
|
|
SOLUTION_FILE_PATH: .
|
|
|
|
BUILD_CONFIGURATION: Release
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: windows-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout latest build and submodules
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: recursive
|
|
|
|
|
|
|
|
- name: Add MSBuild to PATH
|
|
|
|
uses: microsoft/setup-msbuild@v1.0.2
|
|
|
|
|
2021-11-05 03:46:14 +01:00
|
|
|
- name: Declare some variables
|
|
|
|
id: vars
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
|
|
|
|
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
|
|
|
|
2021-11-05 00:37:09 +01:00
|
|
|
- name: Create funchook build directory
|
|
|
|
shell: powershell
|
|
|
|
working-directory: libs/funchook
|
|
|
|
run: |
|
|
|
|
New-Item build -ItemType Directory
|
|
|
|
|
|
|
|
- name: Generate funchook build files
|
|
|
|
shell: cmd
|
|
|
|
working-directory: libs/funchook/build
|
|
|
|
run: |
|
|
|
|
cmake -G "Visual Studio 16 2019" -A x64 ..
|
|
|
|
|
|
|
|
- name: Patch funchook to compile as /MT
|
|
|
|
shell: powershell
|
|
|
|
working-directory: libs/funchook/build
|
|
|
|
run: |
|
|
|
|
(Get-Content funchook-static.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>', '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>' | Out-File -encoding ASCII funchook-static.vcxproj
|
|
|
|
|
|
|
|
- name: Build funchook
|
|
|
|
shell: cmd
|
|
|
|
working-directory: libs/funchook/build
|
|
|
|
run: |
|
|
|
|
cmake --build . --config Release
|
2021-11-05 03:46:14 +01:00
|
|
|
|
2021-11-05 00:37:09 +01:00
|
|
|
- name: Build EP IA-32
|
|
|
|
working-directory: ${{env.GITHUB_WORKSPACE}}
|
|
|
|
run: |
|
|
|
|
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=IA-32 ${{env.SOLUTION_FILE_PATH}}
|
2021-11-05 03:46:14 +01:00
|
|
|
|
2021-11-05 00:37:09 +01:00
|
|
|
- name: Build EP amd64
|
|
|
|
working-directory: ${{env.GITHUB_WORKSPACE}}
|
|
|
|
run: |
|
2021-11-05 03:46:14 +01:00
|
|
|
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=amd64 ${{env.SOLUTION_FILE_PATH}}
|
|
|
|
|
|
|
|
- name: Generate dxgi.dll
|
|
|
|
shell: powershell
|
|
|
|
working-directory: build/Release
|
|
|
|
run: |
|
|
|
|
Copy-Item ExplorerPatcher.amd64.dll dxgi.dll
|
2021-11-05 05:11:53 +01:00
|
|
|
|
|
|
|
- name: Upload artifacts
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: bin
|
|
|
|
path: |
|
|
|
|
build/Release/
|
|
|
|
|
2021-11-05 03:46:14 +01:00
|
|
|
- name: Generate release name
|
|
|
|
shell: bash
|
|
|
|
working-directory: build/Release
|
2021-11-05 05:11:53 +01:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-11-05 03:46:14 +01:00
|
|
|
run: |
|
|
|
|
echo "::set-output name=data::$(./ep_generate_release_name.exe)"
|
|
|
|
id: release_name
|
|
|
|
|
|
|
|
- name: Generate release notes
|
|
|
|
shell: bash
|
|
|
|
working-directory: build/Release
|
2021-11-05 05:11:53 +01:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-11-05 03:46:14 +01:00
|
|
|
run: |
|
|
|
|
MY_STRING=$(./ep_generate_release_description.exe ${{ steps.vars.outputs.sha_short }} ${{ steps.vars.outputs.branch }})
|
|
|
|
MY_STRING="${MY_STRING//'%'/'%25'}"
|
|
|
|
MY_STRING="${MY_STRING//$'\n'/'%0A'}"
|
|
|
|
MY_STRING="${MY_STRING//$'\r'/'%0D'}"
|
|
|
|
echo "::set-output name=data::$MY_STRING"
|
|
|
|
id: release_description
|
|
|
|
|
|
|
|
- name: Create/update release
|
|
|
|
uses: actions/create-release@v1
|
2021-11-05 05:11:53 +01:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-11-05 03:46:14 +01:00
|
|
|
id: create_release
|
|
|
|
with:
|
|
|
|
draft: false
|
|
|
|
prerelease: false
|
|
|
|
release_name: ${{ steps.release_name.outputs.data }}
|
|
|
|
tag_name: ${{ steps.release_name.outputs.data }}_${{ steps.vars.outputs.sha_short }}
|
|
|
|
body: ${{ steps.release_description.outputs.data }}
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
|
|
|
|
|
|
|
- name: Upload dxgi.dll
|
|
|
|
uses: actions/upload-release-asset@v1
|
2021-11-05 05:11:53 +01:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-11-05 03:46:14 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: ./build/Release/dxgi.dll
|
|
|
|
asset_name: dxgi.dll
|
|
|
|
asset_content_type: application/x-msdownload
|
|
|
|
|
|
|
|
- name: Upload ExplorerPatcher.amd64.dll
|
|
|
|
uses: actions/upload-release-asset@v1
|
2021-11-05 05:11:53 +01:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-11-05 03:46:14 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: ./build/Release/ExplorerPatcher.amd64.dll
|
|
|
|
asset_name: ExplorerPatcher.amd64.dll
|
|
|
|
asset_content_type: application/x-msdownload
|
|
|
|
|
|
|
|
- name: Upload ExplorerPatcher.IA-32.dll
|
|
|
|
uses: actions/upload-release-asset@v1
|
2021-11-05 05:11:53 +01:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2021-11-05 03:46:14 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.PAT }}
|
|
|
|
with:
|
|
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
|
|
asset_path: ./build/Release/ExplorerPatcher.IA-32.dll
|
|
|
|
asset_name: ExplorerPatcher.IA-32.dll
|
2021-11-05 05:11:53 +01:00
|
|
|
asset_content_type: application/x-msdownload
|