-
Notifications
You must be signed in to change notification settings - Fork 5
131 lines (114 loc) · 4.37 KB
/
Win64_DX12_Release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: "Win64 DX12 Release "
on:
push:
branches: [ "master" ]
paths:
- '**/*.vcxproj'
- '**/*.h'
- '**/*.hpp'
- '**/*.c'
- '**/*.cpp'
- '**/*.inl'
- '**/*.hlsli'
- '**/*.hlsl.h'
pull_request:
branches: [ "master" ]
paths:
- '**/*.vcxproj'
- '**/*.h'
- '**/*.hpp'
- '**/*.c'
- '**/*.cpp'
- '**/*.inl'
- '**/*.hlsli'
- '**/*.hlsl.h'
env:
# Path to the solution file relative to the root of the project.
SOLUTION_FILE_PATH: vgframework.sln
# 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
# Platform to build.
BUILD_PLATFORM: '"Win64 DX12"'
permissions:
contents: read
jobs:
build_win64_dx12_release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
with:
vs-version: '[17.11.2, 18.0.0)'
- name: Restore NuGet packages
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: nuget restore ${{ env.SOLUTION_FILE_PATH }}
- name: Build
working-directory: ${{ env.GITHUB_WORKSPACE }}
# Add additional options to the MSBuild command line here (like platform or verbosity level).
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
run: msbuild /m /p:Configuration=${{ env.BUILD_CONFIGURATION }} /p:Platform=${{ env.BUILD_PLATFORM }} ${{ env.SOLUTION_FILE_PATH }}
- name: Success Notification
if: ${{ success() }}
run: |
$DISCORD_BUILD_WEBHOOK_URL = "${{ secrets.DISCORD_BUILD_WEBHOOK_URL }}"
$jsonPayload = @"
{
"username": "GitHub",
"content": "",
"embeds": [
{
"type": "rich",
"title": "Win64 DX12 Release build succeeded",
"description": "${{ github.event.head_commit.message }}",
"color": 38912,
"thumbnail": {
"url": "https://github.com/vimontgames/vgframework/blob/master/doc/img/buildsuccess.png?raw=true"
},
"author": {
"name": "$($env:GITHUB_ACTOR)",
"url": "https://github.com/$($env:GITHUB_ACTOR)",
"icon_url": "https://avatars.githubusercontent.com/u/$($env:GITHUB_ACTOR_ID)?v=4"
},
"url": "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs"
}
]
}
"@
$RESPONSE = curl -H "Content-Type: application/json" -X POST -d $jsonPayload $DISCORD_BUILD_WEBHOOK_URL
Write-Output "Webhook server response: $RESPONSE"
- name: Failure Notification
if: ${{ failure() }}
run: |
$DISCORD_BUILD_WEBHOOK_URL = "${{ secrets.DISCORD_BUILD_WEBHOOK_URL }}"
$jsonPayload = @"
{
"username": "GitHub",
"content": "",
"embeds": [
{
"type": "rich",
"title": "Win64 DX12 Release build failed",
"description": "${{ github.event.head_commit.message }}",
"color": 16515049,
"thumbnail": {
"url": "https://github.com/vimontgames/vgframework/blob/master/doc/img/buildfailed.png?raw=true"
},
"author": {
"name": "$($env:GITHUB_ACTOR)",
"url": "https://github.com/$($env:GITHUB_ACTOR)",
"icon_url": "https://avatars.githubusercontent.com/u/$($env:GITHUB_ACTOR_ID)?v=4"
},
"url": "https://github.com/vimontgames/vgframework"
}
]
}
"@
$RESPONSE = curl -H "Content-Type: application/json" -X POST -d $jsonPayload $DISCORD_BUILD_WEBHOOK_URL
Write-Output "Webhook server response: $RESPONSE"