Skip to content

Commit

Permalink
Update cmake.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
chakibchemso authored Jan 22, 2023
1 parent 39592a2 commit 1c6cdc1
Showing 1 changed file with 51 additions and 17 deletions.
68 changes: 51 additions & 17 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ name: CMake
on: [push, workflow_dispatch]

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: RelWithDebInfo
VULKAN_SDK: C:\\VulkanSDK\\1.2.162.1
BUILD_TYPE: Release
VULKAN_SDK: C:\\VulkanSDK\\1.2.189.0

permissions:
id-token: "write"
contents: "write"
packages: "write"
pull-requests: "read"

jobs:
build:
# TODO: Cleanup, improve build times
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Get commit hash
run: echo "CommitHash=$(git rev-parse --short=7 HEAD)" >> $env:GITHUB_ENV

- name: Create Build Environment
# Some projects don't allow in-source building, so create a separate build directory
# We'll use this as our working directory for all subsequent commands
Expand All @@ -32,28 +35,29 @@ jobs:
id: cache-vulkan-sdk
uses: actions/cache@v1
with:
path: "C:\\VulkanSDK\\1.2.162.1"
key: vulkan-sdk-1.2.162.1
path: "C:\\VulkanSDK\\1.2.189.0"
key: vulkan-sdk-1.2.189.0

- name: Setup Vulkan
if: steps.cache-vulkan-sdk.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.2.162.1/windows/VulkanSDK-1.2.162.1-Installer.exe" -OutFile VulkanSDK.exe
Invoke-WebRequest -Uri "https://sdk.lunarg.com/sdk/download/1.2.189.0/windows/VulkanSDK-1.2.189.0-Installer.exe" -OutFile VulkanSDK.exe
$installer = Start-Process -FilePath VulkanSDK.exe -Wait -PassThru -ArgumentList @("/S");
$installer.WaitForExit();
- name: Add msbuild to PATH
uses: microsoft/[email protected]

# Restore from cache the previously built ports. If cache-miss, download, build vcpkg.
- name: Restore from cache and install vcpkg
# Download and build vcpkg, without installing any port. If content is cached already, it is a no-op.
uses: lukka/run-vcpkg@v10
uses: lukka/run-vcpkg@v10.7
with:
setupOnly: true
vcpkgGitCommitId: 097a31d4c3127f38a6fbf4002122550dd9d39b84
vcpkgGitCommitId: 1e9facc7992107ad639b4dcc87bd9a7ade1594e8
# Now that vcpkg is installed, it is being used to run desired arguments.
- run: |
$VCPKG_ROOT/vcpkg install @response_file.txt
shell: bash
- name: Configure CMake x64
# Use a bash shell so we can use the same syntax for environment variable
# access regardless of the host operating system
Expand Down Expand Up @@ -104,20 +108,50 @@ jobs:
# Execute the build. You can specify a specific target with "--target <NAME>"
run: cmake --build . --config $BUILD_TYPE --target gta_3_render_hook gta_vc_render_hook gta_sa_render_hook

- name: Artifacts GTA 3
- name: Upload artifacts - GTA 3
uses: actions/upload-artifact@v2
with:
name: gta3_rh
path: ${{runner.workspace}}/artifacts/gta3

- name: Artifacts GTA VC
- name: Upload artifacts - GTA VC
uses: actions/upload-artifact@v2
with:
name: gtavc_rh
path: ${{runner.workspace}}/artifacts/gtavc

- name: Artifacts GTA SA
- name: Upload artifacts - GTA SA
uses: actions/upload-artifact@v2
with:
name: gtasa_rh
path: ${{runner.workspace}}/artifacts/gtasa

- name: Create Artifacts folder
run: mkdir "Release"

- name: Compress GTA3 artifacts
uses: vimtor/[email protected]
with:
files: 'artifacts/gta3/'
dest: 'Release/gta3_rh.zip'

- name: Compress GTAVC artifacts
uses: vimtor/[email protected]
with:
files: 'artifacts/gtavc/'
dest: 'Release/gtavc_rh.zip'

- name: Compress GTASA artifacts
uses: vimtor/[email protected]
with:
files: 'artifacts/gtasa/'
dest: 'Release/gtasa_rh.zip'

- name: GitHub release
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{secrets.GITHUB_TOKEN}}"
automatic_release_tag: "latest"
prerelease: false
title: "RenderHook-${{env.CommitHash}}"
files: "Release/*"

0 comments on commit 1c6cdc1

Please sign in to comment.