forked from coddec/Classic-Shell
-
Notifications
You must be signed in to change notification settings - Fork 521
211 lines (187 loc) · 7.22 KB
/
Copy pathbuild.yml
File metadata and controls
211 lines (187 loc) · 7.22 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Build
permissions:
contents: read # Default to secure
on:
pull_request:
branches:
- master
paths:
- 'Src/**'
- 'Localization/**'
- '.github/workflows/build.yml'
workflow_dispatch: # allows manual trigger for main/master
jobs:
build:
runs-on: windows-2022
outputs:
new_version: ${{ steps.versioning.outputs.NEW_VERSION }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0 # Essential to see all tags
- name: Prepare version
id: versioning
shell: pwsh
run: |
# Fetch latest tag
$latestTag = git describe --tags --abbrev=0 2>$null
if ($latestTag -notmatch '^v\d+\.\d+\.\d+$') {
Write-Error "Error: Could not find a valid vX.Y.Z tag in history. Found: '$latestTag'"
exit 1
}
# Parse and Increment
$version = [version]$latestTag.Substring(1)
$baseVersion = "$($version.Major).$($version.Minor).$($version.Build + 1)"
# Handle PR Suffix
if ("${{ github.event_name }}" -eq "pull_request") {
$shortSha = "${{ github.event.pull_request.head.sha }}".Substring(0, 7)
$finalVersion = "$baseVersion-pr-$shortSha"
} else {
$finalVersion = $baseVersion
}
# Export
"NEW_VERSION=$finalVersion" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
Write-Host "Building version: $finalVersion"
- name: Build binaries
shell: cmd
env:
CS_VERSION: ${{ steps.versioning.outputs.NEW_VERSION }}
run: Src\Setup\BuildBinaries.bat
- name: Upload binaries
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' # Only manual master builds
id: upload-binaries
uses: actions/upload-artifact@v7
with:
name: Binaries
path: |
Src/Setup/Output/
!Src/Setup/Output/*.skin
!Src/Setup/Output/*.skin7
!Src/Setup/Output/*.zip
retention-days: 1
- name: Sign binaries with SignPath
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' # Only manual master builds
uses: signpath/github-action-submit-signing-request@v2
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: 'b34b60e3-e5bf-4a6e-a13c-dcf641b4362c'
project-slug: 'Open-Shell-Menu'
signing-policy-slug: 'release-signing'
artifact-configuration-slug: 'Binaries'
github-artifact-id: '${{ steps.upload-binaries.outputs.artifact-id }}'
wait-for-completion: true
output-artifact-directory: 'Src/Setup/Output/'
- name: Build installers
shell: cmd
env:
CS_VERSION: ${{ steps.versioning.outputs.NEW_VERSION }}
run: Src\Setup\_BuildEnglish.bat
- name: Upload installers
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' # Only manual master builds
id: upload-installers
uses: actions/upload-artifact@v7
with:
name: MSI
path: |
Src/Setup/Temp/*.msi
retention-days: 1
- name: Sign installers with SignPath
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' # Only manual master builds
uses: signpath/github-action-submit-signing-request@v2
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: 'b34b60e3-e5bf-4a6e-a13c-dcf641b4362c'
project-slug: 'Open-Shell-Menu'
signing-policy-slug: 'release-signing'
artifact-configuration-slug: 'Installers'
github-artifact-id: '${{ steps.upload-installers.outputs.artifact-id }}'
wait-for-completion: true
output-artifact-directory: 'Src/Setup/Temp/'
- name: Build setup and symbols
shell: cmd
env:
CS_VERSION: ${{ steps.versioning.outputs.NEW_VERSION }}
run: Src\Setup\BuildArchives.bat
- name: Upload symbols
uses: actions/upload-artifact@v7
with:
path: |
Src/Setup/Final/OpenShellSymbols*.7z
archive: false
- name: Upload utility
uses: actions/upload-artifact@v7
with:
path: |
Src/Setup/Final/Utility.exe
archive: false
- name: Upload setup
id: upload-setup
uses: actions/upload-artifact@v7
with:
path: |
Src/Setup/Final/OpenShellSetup*.exe
archive: false
- name: Sign setup with SignPath
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' # Only manual master builds
uses: signpath/github-action-submit-signing-request@v2
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: 'b34b60e3-e5bf-4a6e-a13c-dcf641b4362c'
project-slug: 'Open-Shell-Menu'
signing-policy-slug: 'release-signing'
github-artifact-id: '${{ steps.upload-setup.outputs.artifact-id }}'
wait-for-completion: true
skip-decompress: true
output-artifact-directory: 'Src/Setup/Final/'
# `overwrite: true` doesn't work with `archive: false`, so we have to delete the original first
# https://github.com/actions/upload-artifact/issues/769
# https://github.com/actions/upload-artifact/issues/785
- name: Delete temporary artifacts
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' # Only manual master builds
uses: geekyeggo/delete-artifact@v6
with:
name: |
OpenShellSetup*.exe
Binaries
MSI
- name: Upload setup (signed)
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' # Only manual master builds
uses: actions/upload-artifact@v7
with:
path: |
Src/Setup/Final/OpenShellSetup*.exe
archive: false
overwrite: true
release:
if: github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' # Only manual master builds
needs: build
runs-on: ubuntu-latest # Cheaper/faster than windows for just uploading
permissions:
contents: write # Elevate permissions ONLY for this job
steps:
- name: Download setup
uses: actions/download-artifact@v8
with:
pattern: OpenShellSetup*.exe
- name: Download symbols
uses: actions/download-artifact@v8
with:
pattern: OpenShellSymbols*.7z
- name: Download utility
uses: actions/download-artifact@v8
with:
pattern: Utility.exe
- name: Create GitHub Release
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ needs.build.outputs.new_version }}
name: ${{ needs.build.outputs.new_version }}
generate_release_notes: true
prerelease: true
files: |
OpenShellSetup*.exe
OpenShellSymbols_*.7z
Utility.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}