-
Notifications
You must be signed in to change notification settings - Fork 22
181 lines (173 loc) · 6 KB
/
ci.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: CI
on:
- push # standard push on main or other branches
- workflow_dispatch # run manually via Github UI
- create # i.e. tags
jobs:
build:
name: Build TemplePlus
runs-on: windows-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
release: ${{ steps.get_version.outputs.release }}
steps:
- id: get_version
name: Determine Version Number
run: |
"Building Ref: $($env:GITHUB_REF)"
if ($env:GITHUB_REF -notmatch "^refs/tags/v(\d+\.\d+(?:\.\d+)*(?:|-.*))$") {
"Tag name doesnt match release pattern. Building Snapshot Build."
$version = "0.2.$($env:GITHUB_RUN_NUMBER)"
$release = "false"
} else {
"Building Release Build"
$version = $Matches[1]
$release = "true"
}
"Version Number: $version"
"Release Build: $release"
# Make it available to the Github Workflow
Add-Content -Path $env:GITHUB_OUTPUT -Value "version=$version"
Add-Content -Path $env:GITHUB_OUTPUT -Value "release=$release"
shell: powershell
- uses: actions/checkout@v4
- uses: nuget/setup-nuget@v1
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Download and Extract Dependencies
run: |
curl -L -o dependencies.7z https://github.com/GrognardsFromHell/Dependencies/releases/download/v1.19/dependencies.7z
7z x dependencies.7z
- name: Install NuGet packages
run: |
nuget install Squirrel.Windows -OutputDirectory Squirrel -Verbosity Detailed
nuget restore
- name: Build
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
msbuild TemplePlus.sln /p:Configuration=Release /p:Platform=Win32 /p:MSBuildDefines="_TP_VERSION=%TEMPLEPLUS_VERSION%;_TP_COMMIT=%COMMIT_ID%;TP_RELEASE_BUILD" /verbosity:minimal
# Need to use cmd because of the vcvars32 batch file
shell: cmd
env:
TEMPLEPLUS_VERSION: ${{ steps.get_version.outputs.version }}
COMMIT_ID: ${GITHUB_SHA::8}
- name: Pack Release
run: .\PackRelease.ps1
shell: powershell
env:
TEMPLEPLUS_VERSION: ${{ steps.get_version.outputs.version }}
- name: Pack Symbols
shell: cmd
# Package the symbol files, dump_syms needs the dev tools to be on the PATH
run: |
set PATH=%PATH%;C:\Program Files\Microsoft Visual Studio\2022\Enterprise\DIA SDK\bin
dependencies\bin\dump_syms.exe Release\TemplePlus.pdb > TemplePlus.sym
7z a TemplePlusSymbols-${{ steps.get_version.outputs.version }}.zip TemplePlus.sym Release\TemplePlus.pdb
- name: Pack Tools
shell: cmd
# Release Full with tools and all binaries
run: |
rd /s /q dist || cd .
mkdir dist
copy Release\*.exe dist
del dist\TemplePlus.exe
del dist\*Tests.exe
del dist\*.vshost.exe
copy Release\*.dll dist
copy dependencies\bin\*.dll dist
7z a TemplePlusTools-${{ steps.get_version.outputs.version }}.zip dist\*
- name: Upload ZIP-Distribution
uses: actions/upload-artifact@v4
with:
name: TemplePlus
path: TemplePlus-*.zip
- name: Upload PDB
uses: actions/upload-artifact@v4
with:
name: TemplePlusSymbols
path: TemplePlusSymbols-*.zip
- name: Upload Tools
uses: actions/upload-artifact@v4
with:
name: TemplePlusTools
path: TemplePlusTools-*.zip
- name: Upload Nuget Package
uses: actions/upload-artifact@v4
with:
name: TemplePlusNuget
path: TemplePlus*.nupkg
upload-release-symbols:
name: Upload Release Symbols
runs-on: ubuntu-latest
needs: build
if: ${{ needs.build.outputs.release == 'true' }}
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: TemplePlusSymbols
- name: Uncompress Symbol Files
run: unzip TemplePlusSymbols*.zip
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::871006114897:role/templeplus-deploy-symbols
role-session-name: UploadTemplePlusSymbols
aws-region: eu-west-1
- name: Upload Symbols to S3
run: python -u deploy_symbols_s3.py TemplePlus.sym
package-release:
name: Package Release
runs-on: windows-latest
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: TemplePlusNuget
- uses: nuget/setup-nuget@v1
- name: Install Squirrel
run: nuget install Squirrel.Windows -OutputDirectory Squirrel -Verbosity Detailed
- name: Package Release
run: .\BuildRelease.ps1
shell: powershell
env:
TEMPLEPLUS_VERSION: ${{ needs.build.outputs.version }}
- name: Upload Update-Site
uses: actions/upload-artifact@v4
with:
name: UpdateSite
path: releases-packages/
create-release:
name: Create Github Release
runs-on: ubuntu-latest
permissions:
contents: write
needs:
- build
- package-release
if: ${{ needs.build.outputs.release == 'true' }}
steps:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R
working-directory: artifacts
- name: Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
name: "TemplePlus ${{ needs.build.outputs.version }}"
tag_name: v${{ needs.build.outputs.version }}
fail_on_unmatched_files: true
draft: true
files: |
artifacts/TemplePlus/*
artifacts/TemplePlusSymbols/*
artifacts/TemplePlusTools/*
artifacts/UpdateSite/*