1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-28 01:10:55 +01:00
ExplorerPatcher/.github/workflows/build.yml

180 lines
6.2 KiB
YAML
Raw Normal View History

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
on:
push:
branches:
- '**'
tags-ignore:
- '**'
pull_request:
branches:
- '**'
tags-ignore:
- '**'
2021-11-12 21:34:32 +01:00
workflow_dispatch:
inputs:
ref:
description: 'Commit'
required: true
config:
description: 'Configuration'
required: false
build_dir:
description: 'Build dir'
required: false
2021-11-05 00:37:09 +01:00
env:
SOLUTION_FILE_PATH: .
BUILD_CONFIGURATION: Release
jobs:
build:
runs-on: windows-latest
steps:
2021-11-12 21:34:32 +01:00
- name: Print inputs
shell: bash
run: |
echo "ref: ${{ github.event.inputs.ref }}"
echo "config: ${{ github.event.inputs.config }}"
echo "build_dir: ${{ github.event.inputs.build_dir }}"
2021-11-05 00:37:09 +01:00
- name: Checkout latest build and submodules
uses: actions/checkout@v2
2021-11-12 21:34:32 +01:00
if: github.event.inputs.ref == ''
with:
submodules: recursive
- name: Checkout specific build and submodules
uses: actions/checkout@v2
if: github.event.inputs.ref != ''
2021-11-05 00:37:09 +01:00
with:
2021-11-12 21:34:32 +01:00
ref: ${{ github.event.inputs.ref }}
2021-11-05 00:37:09 +01:00
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-12 21:34:32 +01:00
- name: Enable SimpleWindowSwitcher support for newer Windows SDKs
shell: cmd
run: |
cd libs/sws
C:\msys64\usr\bin\wget.exe https://github.com/valinet/sws/commit/972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch
C:\msys64\usr\bin\dos2unix.exe 972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch
C:\msys64\usr\bin\dos2unix.exe SimpleWindowSwitcher/sws_def.h
C:\msys64\usr\bin\patch.exe -N SimpleWindowSwitcher/sws_def.h 972acb76d1e6429133c92ed7cdefd29b9a2c6179.patch
C:\msys64\usr\bin\unix2dos.exe SimpleWindowSwitcher/sws_def.h
exit /b 0
- name: Build funchook
2021-11-05 00:37:09 +01:00
shell: powershell
run: |
cd libs/funchook
md build
cd build
2021-11-05 00:37:09 +01:00
cmake -G "Visual Studio 16 2019" -A x64 ..
(gc .\funchook-static.vcxproj) -replace '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>', '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>' | Out-File .\funchook-static.vcxproj
2021-11-05 00:37:09 +01:00
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
2021-11-12 21:34:32 +01:00
if: github.event.inputs.config == ''
2021-11-05 00:37:09 +01:00
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=IA-32 ${{env.SOLUTION_FILE_PATH}}
2021-11-12 21:34:32 +01:00
2021-11-05 00:37:09 +01:00
- name: Build EP amd64
2021-11-12 21:34:32 +01:00
if: github.event.inputs.config == ''
2021-11-05 00:37:09 +01:00
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}}
2021-11-12 21:34:32 +01:00
- name: Build EP custom
if: github.event.inputs.config != ''
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{ github.event.inputs.config }} ${{env.SOLUTION_FILE_PATH}}
- name: Create expected build directory
if: github.event.inputs.build_dir != ''
shell: bash
run: |
mkdir build
cp -r ${{ github.event.inputs.build_dir }}/Release build/Release
2021-11-05 03:46:14 +01:00
- name: Generate dxgi.dll
2021-11-12 21:34:32 +01:00
shell: bash
2021-11-05 03:46:14 +01:00
working-directory: build/Release
run: |
2021-11-12 21:34:32 +01:00
if [[ -f "ExplorerPatcher.amd64.dll" ]]; then cp ExplorerPatcher.amd64.dll dxgi.dll; fi
2021-11-14 18:59:10 +01:00
- name: Patch setup
shell: cmd
working-directory: build/Release
run: |
ep_setup_patch.exe
exit 0
2021-11-05 05:11:53 +01:00
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
2021-11-05 07:17:47 +01:00
name: ep_bin_multi_${{ steps.vars.outputs.sha_short }}_${{ steps.vars.outputs.branch }}
2021-11-05 05:11:53 +01:00
path: |
build/Release/
2021-11-05 03:46:14 +01:00
- name: Generate release name
shell: bash
working-directory: build/Release
2021-11-12 21:34:32 +01:00
if: github.ref == 'refs/heads/master' && github.event.inputs.ref == ''
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-12 21:34:32 +01:00
if: github.ref == 'refs/heads/master' && github.event.inputs.ref == ''
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 }} ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
2021-11-05 03:46:14 +01:00
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-12 21:34:32 +01:00
if: github.ref == 'refs/heads/master' && github.event.inputs.ref == ''
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 }}
2021-11-14 18:59:10 +01:00
- name: Upload setup
uses: actions/upload-release-asset@v1
2021-11-12 21:34:32 +01:00
if: github.ref == 'refs/heads/master' && github.event.inputs.ref == ''
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
2021-11-14 18:59:10 +01:00
asset_path: ./build/Release/ep_setup.exe
asset_name: ep_setup.exe
asset_content_type: application/x-msdownload