Skip to content

Commit

Permalink
feat: create macOS targz
Browse files Browse the repository at this point in the history
  • Loading branch information
agateau-gg committed Aug 7, 2024
1 parent 767bd32 commit b926859
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions scripts/build-os-packages/build-os-packages
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ step_copy_files() {
die "Can't find '$pyinstaller_ggshield', maybe 'build' step did not run?"
fi

# linux, macOS tgz
# $ARCHIVE_NAME/ggshield
# $ARCHIVE_NAME/internal

# macOS pkg
# $ARCHIVE_NAME/usr/local/bin/ggshield
# $ARCHIVE_NAME/opt/gitguardian/ggshield-$VERSION/ggshield
# $ARCHIVE_NAME/opt/gitguardian/ggshield-$VERSION/internal
# ------------------------------^

mkdir -p "$PACKAGES_DIR"
case "$HUMAN_OS" in
Linux|Windows)
Expand Down Expand Up @@ -282,29 +292,42 @@ step_create_archive() {
tar -czf "$archive_path" "$ARCHIVE_DIR_NAME"
popd
create_linux_packages
info "Archive created in $archive_path"
;;
macOS)
archive_path="$PACKAGES_DIR/$ARCHIVE_DIR_NAME.pkg"
# tar.gz
archive_path="$PACKAGES_DIR/$ARCHIVE_DIR_NAME.tar.gz"
pushd "$PACKAGES_DIR/$ARCHIVE_DIR_NAME/$INSTALL_PREFIX"
tar -czf "$archive_path" --transform "s/^/$ARCHIVE_DIR_NAME/" "$ARCHIVE_DIR_NAME"
popd

echo "DEBUG"
tar tzvf "$archive_path"
echo "/DEBUG"

# pkg
pkg_path="$PACKAGES_DIR/$ARCHIVE_DIR_NAME.pkg"
pushd "$PACKAGES_DIR"
pkgbuild \
--identifier com.gitguardian.ggshield \
--version "$VERSION" \
--root "$PACKAGES_DIR/$ARCHIVE_DIR_NAME" \
"$archive_path"
"$pkg_path"
popd

if [ "$DO_SIGN" -eq 1 ] ; then
macos_sign_file "$archive_path"
macos_sign_file "$pkg_path"
fi
info "Archive created in $pkg_path & $archive_path"
;;
Windows)
archive_path="$PACKAGES_DIR/$ARCHIVE_DIR_NAME.zip"
pushd "$PACKAGES_DIR"
7z a "$archive_path" "$ARCHIVE_DIR_NAME"
popd
info "Archive created in $archive_path"
;;
esac
info "Archive created in $archive_path"
}

steps=""
Expand Down

0 comments on commit b926859

Please sign in to comment.