File tree Expand file tree Collapse file tree 11 files changed +74
-48
lines changed Expand file tree Collapse file tree 11 files changed +74
-48
lines changed Original file line number Diff line number Diff line change @@ -261,7 +261,6 @@ jobs:
261
261
TEST_GG_VALID_TOKEN : ${{ secrets.TEST_GG_VALID_TOKEN }}
262
262
TEST_GG_VALID_TOKEN_IGNORE_SHA : ${{ secrets.TEST_GG_VALID_TOKEN_IGNORE_SHA }}
263
263
TEST_UNKNOWN_SECRET : ${{ secrets.TEST_UNKNOWN_SECRET }}
264
-
265
264
- name : Upload artifacts
266
265
uses : actions/upload-artifact@v4
267
266
with :
@@ -272,6 +271,7 @@ jobs:
272
271
packages/ggshield-*.zip
273
272
packages/ggshield-*.rpm
274
273
packages/ggshield_*.deb
274
+ packages/ggshield.*.nupkg
275
275
276
276
# Run some basic tests, the goal is to verify the ggshield binary has all the
277
277
# libraries it needs to run
Original file line number Diff line number Diff line change 82
82
packages/ggshield_*.deb \
83
83
packages/ggshield-*.rpm \
84
84
packages/ggshield-*.zip \
85
+ packages/ggshield.*.nupkg \
85
86
packages/ggshield-*.gz
86
87
87
88
update_vscode_extension :
@@ -151,19 +152,22 @@ jobs:
151
152
push_to_chocolatey :
152
153
needs : build_release_assets
153
154
name : Push to Chocolatey
154
- runs-on : chocolatey/choco
155
+ runs-on : windows-latest
155
156
if : github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
156
157
steps :
157
158
- name : Checkout
158
159
uses : actions/checkout@v4
159
160
160
- - name : Download packages
161
+ - name : Download nupkg
162
+ id : download-nupkg
161
163
uses : actions/download-artifact@v4
162
164
with :
163
- pattern : os-packages-windows-2022
165
+ pattern : ggshield.*.nupkg
164
166
path : packages
165
- merge-multiple : true
166
167
167
168
- name : Push to Chocolatey
169
+ shell : bash
168
170
run : |
169
- scripts/push-to-chocolatey/push-to-chocolatey
171
+ scripts/chocolatey/push packages/ggshield.*.nupkg
172
+ env :
173
+ CHOCOLATEY_API_KEY : ${{ secrets.CHOCOLATEY_API_KEY }}
Original file line number Diff line number Diff line change
1
+ ### Added
2
+
3
+ - Added ggshield nukpg package (for installation with Chocolatey on Windows) to release assets.
Original file line number Diff line number Diff line change @@ -114,6 +114,7 @@ init_system_vars() {
114
114
EXE_EXT=" .exe"
115
115
HUMAN_OS=Windows
116
116
TARGET=" $arch -pc-windows-msvc"
117
+ REQUIREMENTS=" $REQUIREMENTS choco"
117
118
;;
118
119
* )
119
120
die " Unknown OS. uname printed '$out '"
@@ -320,11 +321,8 @@ step_create_archive() {
320
321
info " Archive created in $pkg_path & $archive_path "
321
322
;;
322
323
Windows)
323
- archive_path=" $PACKAGES_DIR /$ARCHIVE_DIR_NAME .zip"
324
- pushd " $PACKAGES_DIR "
325
- 7z a " $archive_path " " $ARCHIVE_DIR_NAME "
326
- popd
327
- info " Archive created in $archive_path "
324
+ create_windows_packages
325
+ test_chocolatey_package
328
326
;;
329
327
esac
330
328
}
Original file line number Diff line number Diff line change @@ -26,3 +26,43 @@ windows_sign() {
26
26
--input " $archive_dir /$INSTALL_PREFIX /ggshield.exe"
27
27
}
28
28
29
+ windows_create_archive () {
30
+ local archive_path=" $PACKAGES_DIR /$ARCHIVE_DIR_NAME .zip"
31
+ pushd " $PACKAGES_DIR "
32
+ 7z a " $archive_path " " $ARCHIVE_DIR_NAME "
33
+ popd
34
+ info " Archive created in $archive_path "
35
+ }
36
+
37
+ windows_build_chocolatey_package () {
38
+ # choco-package will contain everything needed to build the nupkg
39
+ # we delete it a the end.
40
+ mkdir choco-package
41
+ mkdir choco-package/tools
42
+
43
+ cp -r " $PACKAGES_DIR /$ARCHIVE_DIR_NAME /_internal" choco-package/tools
44
+ cp " $PACKAGES_DIR /$ARCHIVE_DIR_NAME /ggshield.exe" choco-package/tools
45
+ cp " $ROOT_DIR /scripts/chocolatey/ggshield.nuspec" choco-package
46
+ cp " $ROOT_DIR /scripts/chocolatey/VERIFICATION.txt" choco-package/tools
47
+ cp " $ROOT_DIR /LICENSE" choco-package/tools/LICENSE.txt
48
+ sed -i " s/__VERSION__/$VERSION /" choco-package/ggshield.nuspec
49
+
50
+ choco pack choco-package/* --version $VERSION --outdir $PACKAGES_DIR
51
+
52
+ info " Chocolatey package created in $PACKAGES_DIR /ggshield.$VERSION .nupkg"
53
+
54
+ rm -rf choco-package
55
+
56
+ }
57
+
58
+ # cf https://docs.chocolatey.org/en-us/create/create-packages/#testing-your-package
59
+ test_chocolatey_package () {
60
+ pushd " $PACKAGES_DIR "
61
+ choco install ggshield --debug --verbose --source . --noop
62
+ popd
63
+ }
64
+
65
+ create_windows_packages () {
66
+ windows_create_archive
67
+ windows_build_chocolatey_package
68
+ }
Original file line number Diff line number Diff line change 1
- # Push to Chocolatey
1
+ # Chocolatey
2
2
3
3
This folder contains everything necessary to build and publish the chocolatey package.
4
4
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ die () {
5
+ echo $* >&2
6
+ exit 1
7
+ }
8
+
9
+ if [ -z " ${CHOCOLATEY_API_KEY:- } " ] ; then
10
+ die ' $CHOCOLATEY_API_KEY is not set'
11
+ fi
12
+
13
+ # parse command line arguments
14
+ choco_nupkg=$1
15
+
16
+ # push to chocolatey
17
+ choco push $choco_nupkg --source https://push.chocolatey.org/ --api-key $CHOCOLATEY_API_KEY
You can’t perform that action at this time.
0 commit comments