forked from BonneCW/GD3D11
-
Notifications
You must be signed in to change notification settings - Fork 18
131 lines (111 loc) · 4.13 KB
/
build.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
name: Build
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
workflow_dispatch:
defaults:
run:
shell: pwsh
jobs:
build:
runs-on: windows-latest
strategy:
matrix:
configuration: [Release_AVX, Release_G1_AVX, Release, Release_G1, Spacer_NET, Launcher]
steps:
- uses: actions/checkout@v4
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
- name: Set tag and directory name env
run: |
$shortHash = $Env:GITHUB_SHA.Substring(0, 9)
echo (-join("CL=/DVERSION_NUMBER#",'\"',"-git-${shortHash}",'\"')) >> $Env:GITHUB_ENV
- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore .
- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
run: msbuild /p:Configuration=${{matrix.configuration}} .
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.configuration }}
path: ${{ matrix.configuration }}/ddraw.dll
retention-days: 2
artifacts:
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Set tag and directory name env
run: |
$tagName = $Env:GITHUB_SHA.Substring(0, 9)
$dirName = "GD3D11-git-$tagName"
echo "Tag: ${tagName}"
echo "Directory: ${dirName}"
echo "RELEASE_VERSION=${tagName}" >> $Env:GITHUB_ENV
echo "RELEASE_DIR=${dirName}" >> $Env:GITHUB_ENV
- uses: actions/download-artifact@v4
- name: Display structure of downloaded files
run: tree
- name: Create distribution
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
mkdir "${{env.RELEASE_DIR}}\GD3D11\shaders\CSFFT" -Force
mkdir "${{env.RELEASE_DIR}}\GD3D11\Bin" -Force
Xcopy "D3D11Engine\Shaders\*" "${{env.RELEASE_DIR}}\GD3D11\shaders" /s
copy "D3D11Engine\CSFFT\*.hlsl" "${{env.RELEASE_DIR}}\GD3D11\shaders\CSFFT"
Xcopy "blobs\Meshes" "${{env.RELEASE_DIR}}\GD3D11\Meshes\" /s
Xcopy "blobs\Textures" "${{env.RELEASE_DIR}}\GD3D11\Textures\" /s
Xcopy "blobs\libs\*" "${{env.RELEASE_DIR}}\" /s
copy "Release_AVX\ddraw.dll" "${{env.RELEASE_DIR}}\GD3D11\Bin\g2a_avx2.dll"
copy "Release\ddraw.dll" "${{env.RELEASE_DIR}}\GD3D11\Bin\g2a.dll"
copy "Release_G1_AVX\ddraw.dll" "${{env.RELEASE_DIR}}\GD3D11\Bin\g1_avx.dll"
copy "Release_G1\ddraw.dll" "${{env.RELEASE_DIR}}\GD3D11\Bin\g1.dll"
copy "Launcher\ddraw.dll" "${{env.RELEASE_DIR}}\"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_DIR }}
path: ${{ env.RELEASE_DIR }}
# higher values don't get us much due to DLLs, libs, textures...
compression-level: 1
- name: zip distribution for nightly
if: github.ref_name == 'master'
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
cd "${{env.RELEASE_DIR}}"
7z a -tzip "..\${{env.RELEASE_DIR}}.zip" -r
- name: Calculate distribution zip hash
if: github.ref_name == 'master'
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
(Get-FileHash "${{env.RELEASE_DIR}}.zip" -Algorithm SHA256).hash | Out-File -FilePath "${{env.RELEASE_DIR}}.zip.sha256"
type "${{env.RELEASE_DIR}}.zip.sha256"
- name: Delete old nightly
if: github.ref_name == 'master'
# v1.0.1
uses: dev-drprasad/delete-tag-and-release@8cd619d00037e4aeb781909c9a6b03940507d0da
with:
delete_release: true
tag_name: nightly
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create new nightly
if: github.ref_name == 'master'
# v1.13.0
uses: ncipollo/release-action@6c75be85e571768fa31b40abf38de58ba0397db5
with:
name: Nightly
tag: nightly
generateReleaseNotes: true
allowUpdates: true
prerelease: true
draft: false
omitDraftDuringUpdate: false
removeArtifacts: true
artifacts: "${{env.RELEASE_DIR}}.zip,${{env.RELEASE_DIR}}.zip.sha256"
token: ${{ secrets.GITHUB_TOKEN }}