Skip to content

Commit f813f33

Browse files
committed
chore: build choco inside build-os-packages script
1 parent 3dff483 commit f813f33

File tree

4 files changed

+42
-49
lines changed

4 files changed

+42
-49
lines changed

.github/workflows/build_release_assets.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,16 +240,6 @@ jobs:
240240
# automatically do it on Windows
241241
pdm run bash -c "scripts/build-os-packages/build-os-packages $args"
242242
243-
- name: Build Chocolatey package & test it
244-
# About test part, cf https://docs.chocolatey.org/en-us/create/create-packages/#testing-your-package
245-
if: startsWith(matrix.os, 'windows-')
246-
shell: bash
247-
run: |
248-
windows_zip=$(find packages -maxdepth 1 -type f -name "*.zip" | grep "windows" | head -n 1)
249-
scripts/chocolatey/pack $windows_zip packages
250-
cd packages
251-
choco install ggshield --debug --verbose --source . --noop
252-
253243
- name: Override base Docker image used for functional tests on Windows
254244
if: matrix.os == 'windows-2022'
255245
# This is required because GitHub Windows runner is not configured to

scripts/build-os-packages/build-os-packages

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,8 @@ step_create_archive() {
320320
info "Archive created in $pkg_path & $archive_path"
321321
;;
322322
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"
323+
create_windows_packages
324+
test_chocolatey_package
328325
;;
329326
esac
330327
}

scripts/build-os-packages/windows-functions.bash

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,43 @@ windows_sign() {
2626
--input "$archive_dir/$INSTALL_PREFIX/ggshield.exe"
2727
}
2828

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+
}

scripts/chocolatey/pack

Lines changed: 0 additions & 34 deletions
This file was deleted.

0 commit comments

Comments
 (0)