forked from flameshot-org/flameshot
-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (175 loc) · 7.63 KB
/
Windows-pack.yml
File metadata and controls
197 lines (175 loc) · 7.63 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
name: Packaging(Windows)
on:
push:
branches:
- master
- fix*
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'docs/**'
pull_request:
paths-ignore:
- 'README.md'
- 'LICENSE'
- 'docs/**'
- 'data/translations/*.ts'
workflow_dispatch:
env:
PRODUCT: flameshot
jobs:
windows-pack:
name: VS 2022 ${{ matrix.config.arch }}-${{ matrix.type }}
runs-on: windows-2025
env:
VCINSTALLDIR: C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC
# 2025.02.14
VCPKG_VERSION: d5ec528843d29e3a52d745a64b469f810b2cedbf
VCPKG_PACKAGES: openssl-windows
OPENSSL_ROOT_DIR: ${{ github.workspace }}\vcpkg\installed\${{ matrix.config.vcpkg_triplet }}\
strategy:
fail-fast: false
matrix:
qt_ver: [6.9.3]
qt_target: [desktop]
config:
- {
arch: x64,
generator: "-G'Visual Studio 17 2022' -A x64",
vcpkg_triplet: x64-windows,
qt_arch: win64_msvc2022_64,
qt_arch_install: msvc2022_64,
pak_arch: win64
}
type: [portable, installer]
steps:
- name: Checkout Source code
if: github.event_name == 'push'
uses: actions/checkout@v4
with:
fetch-depth: 0
# ref: master
- name: Checkout Source code
if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout Source code
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Fix Python path
shell: pwsh
run: |
Remove-Item "$env:LOCALAPPDATA\Microsoft\WindowsApps\python*.exe" -Force -ErrorAction SilentlyContinue
- name: Set env & Print flameshot version
shell: bash
run: |
last_committed_tag=$(git tag -l --sort=-v:refname | head -1)
git_revno=$(git rev-list $(git describe --tags --abbrev=0)..HEAD --count)
git_hash=$(git rev-parse --short HEAD)
ver_info=${last_committed_tag}+git${git_revno}.${git_hash}
echo "=======FLAMESHOT VERSION========"
echo ${last_committed_tag:1}
echo "Details: ${ver_info}"
echo "================================"
# This will allow to build pre-preleases without git tag
# echo "VERSION=${last_committed_tag:1}" >> $GITHUB_ENV
echo "VERSION=$(cat CMakeLists.txt |grep 'set.*(.*FLAMESHOT_VERSION' | sed 's/[^0-9.]*//' |sed 's/)//g')" >> $GITHUB_ENV
echo "VER_INFO=${ver_info}" >> $GITHUB_ENV
echo "GIT_HASH=${git_hash}" >> $GITHUB_ENV
- name: Restore from cache and run vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgArguments: ${{env.VCPKG_PACKAGES}}
vcpkgDirectory: '${{ github.workspace }}\vcpkg'
appendedCacheKey: ${{ matrix.config.vcpkg_triplet }}
vcpkgGitCommitId: ${{ env.VCPKG_VERSION }}
vcpkgTriplet: ${{ matrix.config.vcpkg_triplet }}
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt_ver }}
cache: 'true'
cache-key-prefix: install-qt-action-${{ matrix.qt_ver }}
target: ${{ matrix.qt_target }}
arch: ${{ matrix.config.qt_arch }}
modules: 'qtimageformats'
dir: '${{ github.workspace }}/build/'
- name: Configure
working-directory: build
shell: pwsh
run: |
cmake .. ${{matrix.config.generator}} `
-DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}\vcpkg\scripts\buildsystems\vcpkg.cmake" `
-DENABLE_OPENSSL=ON `
-DCMAKE_BUILD_TYPE=Release `
-DUSE_PORTABLE_CONFIG=${{ contains(matrix.type, 'portable') }}
- name: Compile
working-directory: build
shell: pwsh
run: cmake --build . --config Release
- name: CPack
working-directory: build
shell: pwsh
run: |
# Chocolately made their own package called cpack and its first in the path. This is a hack since we are only using cmake's cpack, doesn't seem to be required after a CI update
#Remove-Item C:\ProgramData\Chocolatey\bin\cpack.exe
If ($env:TYPE -eq "installer")
{
cpack -G WIX -B "$env:GITHUB_WORKSPACE\build\Package"
}
ElseIf($env:TYPE -eq "portable")
{
cpack -G ZIP -B "$env:GITHUB_WORKSPACE\build\Package"
}
env:
TYPE: ${{matrix.type}}
- name: Package Clean
shell: pwsh
run: |
# Remove-Item $env:GITHUB_WORKSPACE\build\Package\_CPack_Packages -Recurse
New-Item -Path $env:GITHUB_WORKSPACE\build\Package\installer -ItemType Directory
New-Item -Path $env:GITHUB_WORKSPACE\build\Package\portable -ItemType Directory
- name: Package Prepare (installer)
if: matrix.type == 'installer'
shell: pwsh
run: |
Move-Item -Path $env:GITHUB_WORKSPACE/build/Package/Flameshot-*-${{ matrix.config.pak_arch }}.msi -Destination $env:GITHUB_WORKSPACE/build/Package/installer/Flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.msi
- name: Package Prepare (portable)
if: matrix.type == 'portable'
shell: pwsh
run: |
Move-Item -Path $env:GITHUB_WORKSPACE/build/Package/flameshot-*-${{ matrix.config.pak_arch }}.zip -Destination $env:GITHUB_WORKSPACE/build/Package/portable/flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.zip
- name: SHA256Sum of Windows installer
if: matrix.type == 'installer'
shell: bash
run: |
sha256sum $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.msi
sha256sum $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.msi > $GITHUB_WORKSPACE/build/Package/installer/Flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.msi.sha256sum
- name: SHA256Sum of Windows portable
if: matrix.type == 'portable'
shell: bash
run: |
sha256sum $GITHUB_WORKSPACE/build/Package/portable/flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.zip
sha256sum $GITHUB_WORKSPACE/build/Package/portable/flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.zip > $GITHUB_WORKSPACE/build/Package/portable/flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.zip.sha256sum
- name: Artifact Upload
if: matrix.type == 'installer'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-win-${{ matrix.config.arch }}-${{ matrix.type }}
path: |
${{ github.workspace }}/build/Package/installer/Flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.msi
${{ github.workspace }}/build/Package/installer/Flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.msi.sha256sum
overwrite: true
- name: Artifact Upload
if: matrix.type == 'portable'
uses: actions/upload-artifact@v4
with:
name: ${{ env.PRODUCT }}-${{ env.VER_INFO }}-artifact-win-${{ matrix.config.arch }}-${{ matrix.type }}
path: |
${{ github.workspace }}/build/Package/portable/flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.zip
${{ github.workspace }}/build/Package/portable/flameshot-${{ env.VERSION }}-${{ matrix.config.pak_arch }}.zip.sha256sum
overwrite: true