-
Notifications
You must be signed in to change notification settings - Fork 3k
146 lines (127 loc) · 4.88 KB
/
vs2022.yml
File metadata and controls
146 lines (127 loc) · 4.88 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
name: VS2022
on:
push:
paths-ignore:
- '.github/ISSUE_TEMPLATE/**'
- '.gitignore'
- '.gitattributes'
- 'res/**'
- '**.cmd'
- '**.md'
- '**.rc'
- '**.sh'
- '**.txt'
- '**.xml'
pull_request:
branches: [master]
paths-ignore:
- '.gitignore'
- '.gitattributes'
- 'res/**'
- '**.cmd'
- '**.md'
- '**.rc'
- '**.sh'
- '**.txt'
- '**.xml'
env:
SOLUTION_FILE_PATH: ./rufus.sln
BUILD_CONFIGURATION: Release
jobs:
VS2022-Build:
runs-on: windows-latest
strategy:
matrix:
TARGET_PLATFORM: [x64, x86, arm64]
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
with:
msbuild-architecture: x64
- name: Install UPX
uses: crazy-max/ghaction-upx@v4
with:
install-only: true
- name: Set version
id: set_version
shell: bash
run: |
version=$(git describe --tags)
version=${version:1}
version=${version%%-*}
echo "version=$version" >> $GITHUB_OUTPUT
- name: Set ALPHA
id: set_alpha
shell: bash
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
# This ONLY works if the shell is bash or if using $env:GITHUB_OUTPUT
run: |
echo "option=/DALPHA" >> $GITHUB_OUTPUT
sed -b -i 's/VALUE "InternalName", "Rufus"/VALUE "InternalName", "Rufus (ALPHA)"/' ./src/rufus.rc
- name: Set BETA
id: set_beta
shell: bash
if: ${{ startsWith(github.ref, 'refs/tags/') && contains(github.ref, 'BETA') }}
# This ONLY works if the shell is bash or if using $env:GITHUB_OUTPUT
run: |
echo "option=/DBETA" >> $GITHUB_OUTPUT
sed -b -i 's/VALUE "InternalName", "Rufus"/VALUE "InternalName", "Rufus (BETA)"/' ./src/rufus.rc
- name: Build
shell: cmd
run: |
set ExternalCompilerOptions=${{ steps.set_alpha.outputs.option }} ${{ steps.set_beta.outputs.option }}
msbuild ${{ env.SOLUTION_FILE_PATH }} /m /p:Configuration=${{ env.BUILD_CONFIGURATION }},Platform=${{ matrix.TARGET_PLATFORM }},ForceImportBeforeCppTargets=%GITHUB_WORKSPACE%\.vs\Generate.PDB.props
move .\${{ matrix.TARGET_PLATFORM }}\Release\rufus.exe .\rufus_${{ matrix.TARGET_PLATFORM }}.exe
move .\${{ matrix.TARGET_PLATFORM }}\Release\rufus.pdb .\rufus_${{ matrix.TARGET_PLATFORM }}.pdb
- name: Prepare to sign ALPHA
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
shell: bash
# NB: The Base64 encoded variable should not have line breaks or this will fail!
run: echo ${{ secrets.RUFUS_GITHUB_OFFICIAL_BUILD }} | base64 -di > ./sign.pfx
- name: Add signtool to path
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: KamaranL/add-signtool-action@v1
- name: Sign ALPHA
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
shell: cmd
run: |
signtool sign /v /f sign.pfx /fd SHA256 /tr http://timestamp.digicert.com /td SHA256 rufus_${{ matrix.TARGET_PLATFORM }}.exe
del sign.pfx
- name: Create standalone release executables
if: ${{ startsWith(github.ref, 'refs/tags/') }}
shell: cmd
run: |
copy rufus_${{ matrix.TARGET_PLATFORM }}.exe rufus-${{ steps.set_version.outputs.version }}_${{ matrix.TARGET_PLATFORM }}.exe
if exist rufus-${{ steps.set_version.outputs.version }}_x64.exe ( ren rufus-${{ steps.set_version.outputs.version }}_x64.exe rufus-${{ steps.set_version.outputs.version }}.exe )
if not ${{ matrix.TARGET_PLATFORM }}==arm64 ( upx --lzma --best rufus-*.exe )
- name: Display SHA-256
run: sha256sum ./rufus_${{ matrix.TARGET_PLATFORM }}.exe
- name: Upload to VirusTotal
continue-on-error: true
if: ${{ github.event_name == 'push' }}
run: |
curl --request POST --url https://www.virustotal.com/vtapi/v2/file/scan --form apikey=${{ secrets.VIRUSTOTAL_API_KEY }} --form file=@./rufus_${{ matrix.TARGET_PLATFORM }}.exe
curl --request POST --url https://www.virustotal.com/api/v3/monitor/items --header 'x-apikey: ${{ secrets.VIRUSTOTAL_API_KEY }}' --form path='/rufus_${{ matrix.TARGET_PLATFORM }}.exe' --form file=@./rufus_${{ matrix.TARGET_PLATFORM }}.exe
- name: Upload artifacts
uses: actions/upload-artifact@v7
if: ${{ github.event_name == 'push' }}
with:
name: ${{ matrix.TARGET_PLATFORM }}
path: |
./*.exe
./*.pdb
Extra-Step-To-Merge-Artifacts-Thanks-To-Upload-Artifact-v4-Breaking-Backwards-Compatibility:
runs-on: windows-latest
needs: VS2022-Build
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v7
if: ${{ github.event_name == 'push' }}
with:
name: VS2022
delete-merged: true