From f1c3534c41ab7f5b5b4d264a035e2a8d6333e348 Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Thu, 8 Jun 2023 17:27:14 +0200
Subject: [PATCH 01/19] Add macOS pkg installer to deployment
---
.github/workflows/deployment.yml | 14 ++++
.goreleaser.yml | 2 +-
build/macOS/distribution.xml | 19 ++++++
script/pkgmacos | 107 +++++++++++++++++++++++++++++++
4 files changed, 141 insertions(+), 1 deletion(-)
create mode 100644 build/macOS/distribution.xml
create mode 100755 script/pkgmacos
diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml
index 3974737aa..e866eea11 100644
--- a/.github/workflows/deployment.yml
+++ b/.github/workflows/deployment.yml
@@ -110,6 +110,19 @@ jobs:
run: |
shopt -s failglob
script/sign dist/gh_*_macOS_*.zip
+ - name: Build universal macOS pkg installer
+ if: inputs.environment != 'production'
+ env:
+ TAG_NAME: ${{ inputs.tag_name }}
+ run: script/pkgmacos "$TAG_NAME"
+ - name: Build & notarize universal macOS pkg installer
+ if: inputs.environment == 'production'
+ env:
+ TAG_NAME: ${{ inputs.tag_name }}
+ APPLE_DEVELOPER_INSTALLER_ID: ${{ vars.APPLE_DEVELOPER_INSTALLER_ID }}
+ run: |
+ shopt -s failglob
+ script/pkgmacos "$TAG_NAME"
- uses: actions/upload-artifact@v3
with:
name: macos
@@ -118,6 +131,7 @@ jobs:
path: |
dist/*.tar.gz
dist/*.zip
+ dist/*.pkg
windows:
runs-on: windows-latest
diff --git a/.goreleaser.yml b/.goreleaser.yml
index f441156e3..7e7424292 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -10,7 +10,7 @@ before:
- >-
{{ if eq .Runtime.Goos "windows" }}echo{{ end }} make manpages GH_VERSION={{.Version}}
- >-
- {{ if ne .Runtime.Goos "linux" }}echo{{ end }} make completions
+ {{ if ne .Runtime.Goos "windows" }}echo{{ end }} make completions
builds:
- id: macos #build:macos
diff --git a/build/macOS/distribution.xml b/build/macOS/distribution.xml
new file mode 100644
index 000000000..35f14d930
--- /dev/null
+++ b/build/macOS/distribution.xml
@@ -0,0 +1,19 @@
+
+
+ Github Cli
+
+
+
+
+
+
+
+
+
+
+
+ #com.github.cli.pkg
+
+
+
+
diff --git a/script/pkgmacos b/script/pkgmacos
new file mode 100755
index 000000000..4646f8d51
--- /dev/null
+++ b/script/pkgmacos
@@ -0,0 +1,107 @@
+#!/bin/zsh
+set -e
+
+print_help() {
+ cat <
+
+To build and sign set APPLE_DEVELOPER_INSTALLER_ID environment variable before.
+For example, if you have a signing identity with the identifier
+"Developer ID Installer: Your Name (ABC123DEF)" set it in the variable.
+EOF
+}
+
+if [ $# -eq 0 ]; then
+ print_help >&2
+ exit 1
+fi
+
+tag_name=""
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -h | --help )
+ print_help
+ exit 0
+ ;;
+ -* )
+ printf "unrecognized flag: %s\n" "$1" >&2
+ exit 1
+ ;;
+ * )
+ tag_name="$1"
+ shift 1
+ ;;
+ esac
+done
+
+# gh-binary paths
+bin_path="/bin/gh"
+arm64_bin="dist/macos_darwin_arm64$bin_path"
+amd64_bin="dist/macos_darwin_amd64_v1$bin_path"
+# payload paths
+payload_root="pkg_payload"
+payload_local_bin="${payload_root}/usr/local/bin"
+payload_zsh_site_functions="${payload_root}/usr/local/share/zsh/site-functions"
+payload_man1="${pkg_payload}/usr/local/share/man/man1"
+
+merge_binaries() {
+ lipo -create -output "${payload_local_bin}/gh" "$arm64_bin" "$amd64_bin"
+}
+
+build_pkg() {
+ # setup payload
+ mkdir -p "${payload_local_bin}"
+ mkdir -p "${payload_man1}"
+ mkdir -p "${payload_zsh_site_functions}"
+
+ # copy man pages
+ for file in "./share/man/man1/gh*.1"; do
+ cp "$file" "${payload_man1}"
+ done
+ # Include only Zsh completions,
+ # the recommended/only option on macOS since Catalina for default shell.
+ cp "./share/zsh/site-functions/_gh" "${payload_zsh_site_functions}"
+
+ # merge binaries
+ merge_binaries
+
+ # build pkg
+ pkgbuild \
+ --root "$payload_root" \
+ --identifier "com.github.cli" \
+ --version "$tag_name" \
+ --install-location "/" \
+ "dist/com.github.cli.pkg"
+
+ # setup resources
+ mkdir "build/macOS/resources"
+ cp "LICENSE" "build/macOS/resources"
+
+ # build distribution
+ if [ -n "$APPLE_DEVELOPER_INSTALLER_ID" ]; then
+ # build and sign production package with license
+ productbuild \
+ --distribution "./build/macOS/distribution.xml" \
+ --resources "./build/macOS/resources" \
+ --package-path "./dist" \
+ --timestamp \
+ --sign "${APPLE_DEVELOPER_INSTALLER_ID?}" \
+ "./dist/gh_${tag_name}_macOS_universal.pkg"
+ else
+ echo "skipping macOS pkg code-signing; APPLE_DEVELOPER_INSTALLER_ID not set" >&2
+
+ # build production package with license without signing
+ productbuild \
+ --distribution "./build/macOS/distribution.xml" \
+ --resources "./build/macOS/resources" \
+ --package-path "./dist" \
+ "./dist/gh_${tag_name}_macOS_universal.pkg"
+ fi
+
+ # remove temp installer so it does not get uploaded
+ rm "dist/com.github.cli.pkg"
+}
+
+build_pkg
From 775476d30b8b4aa77678841c9877c00b47f2b62b Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Mon, 4 Sep 2023 13:43:39 +0200
Subject: [PATCH 02/19] Fix typo in macOS pkg installer build script
---
.gitignore | 2 ++
script/pkgmacos | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/.gitignore b/.gitignore
index b1e8e1fa8..b2b66aaf7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,6 +12,8 @@
/.goreleaser.generated.yml
/script/build
/script/build.exe
+/pkg_payload
+/build/macOS/resources
# VS Code
.vscode
diff --git a/script/pkgmacos b/script/pkgmacos
index 4646f8d51..ba72fef9e 100755
--- a/script/pkgmacos
+++ b/script/pkgmacos
@@ -44,7 +44,7 @@ amd64_bin="dist/macos_darwin_amd64_v1$bin_path"
payload_root="pkg_payload"
payload_local_bin="${payload_root}/usr/local/bin"
payload_zsh_site_functions="${payload_root}/usr/local/share/zsh/site-functions"
-payload_man1="${pkg_payload}/usr/local/share/man/man1"
+payload_man1="${payload_root}/usr/local/share/man/man1"
merge_binaries() {
lipo -create -output "${payload_local_bin}/gh" "$arm64_bin" "$amd64_bin"
@@ -57,7 +57,7 @@ build_pkg() {
mkdir -p "${payload_zsh_site_functions}"
# copy man pages
- for file in "./share/man/man1/gh*.1"; do
+ for file in ./share/man/man1/gh*.1; do
cp "$file" "${payload_man1}"
done
# Include only Zsh completions,
@@ -78,6 +78,7 @@ build_pkg() {
# setup resources
mkdir "build/macOS/resources"
cp "LICENSE" "build/macOS/resources"
+ touch .gi
# build distribution
if [ -n "$APPLE_DEVELOPER_INSTALLER_ID" ]; then
From b1a6ce3e759e3a4060e980242f76da3b975d0c20 Mon Sep 17 00:00:00 2001
From: Paul <44974737+paulober@users.noreply.github.com>
Date: Tue, 21 May 2024 18:23:01 +0200
Subject: [PATCH 03/19] Update pkg title
Co-authored-by: Andy Feller
---
build/macOS/distribution.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build/macOS/distribution.xml b/build/macOS/distribution.xml
index 35f14d930..beca0689c 100644
--- a/build/macOS/distribution.xml
+++ b/build/macOS/distribution.xml
@@ -1,6 +1,6 @@
- Github Cli
+ GitHub CLI
From aeb0ac74ec6475c4a3a71dfd98e6d6bb1161604e Mon Sep 17 00:00:00 2001
From: Paul <44974737+paulober@users.noreply.github.com>
Date: Tue, 21 May 2024 18:26:03 +0200
Subject: [PATCH 04/19] Update choice title
Co-authored-by: Andy Feller
---
build/macOS/distribution.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/build/macOS/distribution.xml b/build/macOS/distribution.xml
index beca0689c..96d593768 100644
--- a/build/macOS/distribution.xml
+++ b/build/macOS/distribution.xml
@@ -8,7 +8,7 @@
-
+
From eb23e0723e00e68a735bb35ad4469a8456c82ba0 Mon Sep 17 00:00:00 2001
From: Paul <44974737+paulober@users.noreply.github.com>
Date: Tue, 21 May 2024 19:39:25 +0200
Subject: [PATCH 05/19] Indentation fix
Co-authored-by: Andy Feller
---
script/pkgmacos | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/script/pkgmacos b/script/pkgmacos
index ba72fef9e..740356808 100755
--- a/script/pkgmacos
+++ b/script/pkgmacos
@@ -69,11 +69,11 @@ build_pkg() {
# build pkg
pkgbuild \
- --root "$payload_root" \
- --identifier "com.github.cli" \
- --version "$tag_name" \
- --install-location "/" \
- "dist/com.github.cli.pkg"
+ --root "$payload_root" \
+ --identifier "com.github.cli" \
+ --version "$tag_name" \
+ --install-location "/" \
+ "dist/com.github.cli.pkg"
# setup resources
mkdir "build/macOS/resources"
From f9d6b1d99b70a17467f3a7894fbc2fd4ca3d60aa Mon Sep 17 00:00:00 2001
From: Paul <44974737+paulober@users.noreply.github.com>
Date: Tue, 21 May 2024 19:43:31 +0200
Subject: [PATCH 06/19] Fix indentation
Co-authored-by: Andy Feller
---
script/pkgmacos | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/script/pkgmacos b/script/pkgmacos
index 740356808..2dc0f8498 100755
--- a/script/pkgmacos
+++ b/script/pkgmacos
@@ -84,12 +84,12 @@ build_pkg() {
if [ -n "$APPLE_DEVELOPER_INSTALLER_ID" ]; then
# build and sign production package with license
productbuild \
- --distribution "./build/macOS/distribution.xml" \
- --resources "./build/macOS/resources" \
- --package-path "./dist" \
- --timestamp \
- --sign "${APPLE_DEVELOPER_INSTALLER_ID?}" \
- "./dist/gh_${tag_name}_macOS_universal.pkg"
+ --distribution "./build/macOS/distribution.xml" \
+ --resources "./build/macOS/resources" \
+ --package-path "./dist" \
+ --timestamp \
+ --sign "${APPLE_DEVELOPER_INSTALLER_ID?}" \
+ "./dist/gh_${tag_name}_macOS_universal.pkg"
else
echo "skipping macOS pkg code-signing; APPLE_DEVELOPER_INSTALLER_ID not set" >&2
From 80830d769e77a0dc02594f9561ec6c31fffaf8cf Mon Sep 17 00:00:00 2001
From: Paul <44974737+paulober@users.noreply.github.com>
Date: Tue, 21 May 2024 19:46:51 +0200
Subject: [PATCH 07/19] Fix indentation
Co-authored-by: Andy Feller
---
script/pkgmacos | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/script/pkgmacos b/script/pkgmacos
index 2dc0f8498..5c5730184 100755
--- a/script/pkgmacos
+++ b/script/pkgmacos
@@ -95,10 +95,10 @@ build_pkg() {
# build production package with license without signing
productbuild \
- --distribution "./build/macOS/distribution.xml" \
- --resources "./build/macOS/resources" \
- --package-path "./dist" \
- "./dist/gh_${tag_name}_macOS_universal.pkg"
+ --distribution "./build/macOS/distribution.xml" \
+ --resources "./build/macOS/resources" \
+ --package-path "./dist" \
+ "./dist/gh_${tag_name}_macOS_universal.pkg"
fi
# remove temp installer so it does not get uploaded
From d2d599daf5af60fa1f38e4875c5bd8fdfaf74235 Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Tue, 21 May 2024 20:00:59 +0200
Subject: [PATCH 08/19] Undo goreleaser change
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
---
.goreleaser.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.goreleaser.yml b/.goreleaser.yml
index cafb5eb05..e469af091 100644
--- a/.goreleaser.yml
+++ b/.goreleaser.yml
@@ -10,7 +10,7 @@ before:
- >-
{{ if eq .Runtime.Goos "windows" }}echo{{ end }} make manpages GH_VERSION={{.Version}}
- >-
- {{ if ne .Runtime.Goos "windows" }}echo{{ end }} make completions
+ {{ if ne .Runtime.Goos "linux" }}echo{{ end }} make completions
builds:
- id: macos #build:macos
From 6e58a2a216934348de34d36e7ff9f28d1a64ab77 Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Tue, 21 May 2024 22:57:01 +0200
Subject: [PATCH 09/19] Fix indentation
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
---
script/pkgmacos | 90 ++++++++++++++++++++++++-------------------------
1 file changed, 45 insertions(+), 45 deletions(-)
diff --git a/script/pkgmacos b/script/pkgmacos
index 5c5730184..1933f7a3e 100755
--- a/script/pkgmacos
+++ b/script/pkgmacos
@@ -51,58 +51,58 @@ merge_binaries() {
}
build_pkg() {
- # setup payload
- mkdir -p "${payload_local_bin}"
- mkdir -p "${payload_man1}"
- mkdir -p "${payload_zsh_site_functions}"
+ # setup payload
+ mkdir -p "${payload_local_bin}"
+ mkdir -p "${payload_man1}"
+ mkdir -p "${payload_zsh_site_functions}"
- # copy man pages
- for file in ./share/man/man1/gh*.1; do
- cp "$file" "${payload_man1}"
- done
- # Include only Zsh completions,
- # the recommended/only option on macOS since Catalina for default shell.
- cp "./share/zsh/site-functions/_gh" "${payload_zsh_site_functions}"
+ # copy man pages
+ for file in ./share/man/man1/gh*.1; do
+ cp "$file" "${payload_man1}"
+ done
+ # Include only Zsh completions,
+ # the recommended/only option on macOS since Catalina for default shell.
+ cp "./share/zsh/site-functions/_gh" "${payload_zsh_site_functions}"
- # merge binaries
- merge_binaries
+ # merge binaries
+ merge_binaries
- # build pkg
- pkgbuild \
- --root "$payload_root" \
- --identifier "com.github.cli" \
- --version "$tag_name" \
- --install-location "/" \
- "dist/com.github.cli.pkg"
+ # build pkg
+ pkgbuild \
+ --root "$payload_root" \
+ --identifier "com.github.cli" \
+ --version "$tag_name" \
+ --install-location "/" \
+ "dist/com.github.cli.pkg"
- # setup resources
- mkdir "build/macOS/resources"
- cp "LICENSE" "build/macOS/resources"
- touch .gi
+ # setup resources
+ mkdir "build/macOS/resources"
+ cp "LICENSE" "build/macOS/resources"
+ touch .gi
- # build distribution
- if [ -n "$APPLE_DEVELOPER_INSTALLER_ID" ]; then
- # build and sign production package with license
- productbuild \
- --distribution "./build/macOS/distribution.xml" \
- --resources "./build/macOS/resources" \
- --package-path "./dist" \
- --timestamp \
- --sign "${APPLE_DEVELOPER_INSTALLER_ID?}" \
- "./dist/gh_${tag_name}_macOS_universal.pkg"
- else
- echo "skipping macOS pkg code-signing; APPLE_DEVELOPER_INSTALLER_ID not set" >&2
+ # build distribution
+ if [ -n "$APPLE_DEVELOPER_INSTALLER_ID" ]; then
+ # build and sign production package with license
+ productbuild \
+ --distribution "./build/macOS/distribution.xml" \
+ --resources "./build/macOS/resources" \
+ --package-path "./dist" \
+ --timestamp \
+ --sign "${APPLE_DEVELOPER_INSTALLER_ID?}" \
+ "./dist/gh_${tag_name}_macOS_universal.pkg"
+ else
+ echo "skipping macOS pkg code-signing; APPLE_DEVELOPER_INSTALLER_ID not set" >&2
- # build production package with license without signing
- productbuild \
- --distribution "./build/macOS/distribution.xml" \
- --resources "./build/macOS/resources" \
- --package-path "./dist" \
- "./dist/gh_${tag_name}_macOS_universal.pkg"
- fi
+ # build production package with license without signing
+ productbuild \
+ --distribution "./build/macOS/distribution.xml" \
+ --resources "./build/macOS/resources" \
+ --package-path "./dist" \
+ "./dist/gh_${tag_name}_macOS_universal.pkg"
+ fi
- # remove temp installer so it does not get uploaded
- rm "dist/com.github.cli.pkg"
+ # remove temp installer so it does not get uploaded
+ rm "dist/com.github.cli.pkg"
}
build_pkg
From 18f41db31aff753491a7cf3260ad4d9d0d79f4af Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Wed, 22 May 2024 00:27:29 +0200
Subject: [PATCH 10/19] Removed redundant specifications
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
---
build/macOS/distribution.xml | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/build/macOS/distribution.xml b/build/macOS/distribution.xml
index 96d593768..54818f52a 100644
--- a/build/macOS/distribution.xml
+++ b/build/macOS/distribution.xml
@@ -4,7 +4,7 @@
-
+
@@ -12,8 +12,5 @@
- #com.github.cli.pkg
-
-
-
+ #com.github.cli.pkg
From 3830c3356c30141c3bfa330691ce86d51de85d7b Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Wed, 22 May 2024 01:43:16 +0200
Subject: [PATCH 11/19] Cleanup pkgmacos build script
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
---
script/pkgmacos | 31 +++++++++++++++++++++++++++----
1 file changed, 27 insertions(+), 4 deletions(-)
diff --git a/script/pkgmacos b/script/pkgmacos
index 1933f7a3e..cc3d09e15 100755
--- a/script/pkgmacos
+++ b/script/pkgmacos
@@ -36,6 +36,26 @@ while [ $# -gt 0 ]; do
esac
done
+# check os requirements: is running macOS 13+ and pkgbuild + productbuild are available
+os_version=$(sw_vers -productVersion)
+major_version=${os_version%%.*}
+
+if (( major_version < 13 )); then
+ echo "This script requires macOS 13 or later. You are running macOS ${os_version}." >&2
+ exit 1
+fi
+
+if ! command -v pkgbuild &> /dev/null; then
+ echo "pkgbuild could not be found. Please install Xcode Command Line Tools." >&2
+ exit 1
+fi
+
+if ! command -v productbuild &> /dev/null; then
+ echo "productbuild could not be found. Please install Xcode Command Line Tools." >&2
+ exit 1
+fi
+# end of os requirements check
+
# gh-binary paths
bin_path="/bin/gh"
arm64_bin="dist/macos_darwin_arm64$bin_path"
@@ -78,7 +98,6 @@ build_pkg() {
# setup resources
mkdir "build/macOS/resources"
cp "LICENSE" "build/macOS/resources"
- touch .gi
# build distribution
if [ -n "$APPLE_DEVELOPER_INSTALLER_ID" ]; then
@@ -100,9 +119,13 @@ build_pkg() {
--package-path "./dist" \
"./dist/gh_${tag_name}_macOS_universal.pkg"
fi
-
- # remove temp installer so it does not get uploaded
- rm "dist/com.github.cli.pkg"
}
+cleanup() {
+ # remove temp installer so it does not get uploaded
+ rm -f "dist/com.github.cli.pkg"
+}
+
+trap cleanup EXIT
+
build_pkg
From 9454d5e71c83a4c0901f7b428aa74793c66b2435 Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Wed, 22 May 2024 01:47:48 +0200
Subject: [PATCH 12/19] Change minimum build script macOS version
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
---
script/pkgmacos | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/script/pkgmacos b/script/pkgmacos
index cc3d09e15..7547c34be 100755
--- a/script/pkgmacos
+++ b/script/pkgmacos
@@ -36,12 +36,12 @@ while [ $# -gt 0 ]; do
esac
done
-# check os requirements: is running macOS 13+ and pkgbuild + productbuild are available
+# check os requirements: is running macOS 12+ and pkgbuild + productbuild are available
os_version=$(sw_vers -productVersion)
major_version=${os_version%%.*}
-if (( major_version < 13 )); then
- echo "This script requires macOS 13 or later. You are running macOS ${os_version}." >&2
+if (( major_version < 12 )); then
+ echo "This script requires macOS 12 or later. You are running macOS ${os_version}." >&2
exit 1
fi
From 85f424bb08a163622fdedbcfc603da09e6f22009 Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Fri, 24 May 2024 15:19:54 +0200
Subject: [PATCH 13/19] Fix directory already exists
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
---
script/pkgmacos | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/script/pkgmacos b/script/pkgmacos
index 7547c34be..7ffdea324 100755
--- a/script/pkgmacos
+++ b/script/pkgmacos
@@ -96,7 +96,7 @@ build_pkg() {
"dist/com.github.cli.pkg"
# setup resources
- mkdir "build/macOS/resources"
+ mkdir -p "build/macOS/resources"
cp "LICENSE" "build/macOS/resources"
# build distribution
From 74392ff654f6fe9da5eb03d69bc52d21d6084505 Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Fri, 24 May 2024 15:25:02 +0200
Subject: [PATCH 14/19] Added make macospkg target
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
---
Makefile | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Makefile b/Makefile
index 7dac0d290..e68b68939 100644
--- a/Makefile
+++ b/Makefile
@@ -93,3 +93,11 @@ uninstall:
rm -f ${DESTDIR}${datadir}/bash-completion/completions/gh
rm -f ${DESTDIR}${datadir}/fish/vendor_completions.d/gh.fish
rm -f ${DESTDIR}${datadir}/zsh/site-functions/_gh
+
+.PHONY: macospkg
+macospkg: manpages completions
+ifndef VERSION
+ $(error VERSION is not set. Use `make macospkg VERSION=vX.Y.Z`)
+endif
+ ./script/release --local "$(VERSION)" --platform macos
+ ./script/pkgmacos $(VERSION)
From 1990952a62f30fda1ff3255f7e7c033651235119 Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Fri, 24 May 2024 16:08:22 +0200
Subject: [PATCH 15/19] Fix distribution.xml + min macos version requirements
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
---
build/macOS/distribution.xml | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/build/macOS/distribution.xml b/build/macOS/distribution.xml
index 54818f52a..773321da3 100644
--- a/build/macOS/distribution.xml
+++ b/build/macOS/distribution.xml
@@ -1,9 +1,21 @@
-
+
GitHub CLI
-
+
+
+
From 27262ff5aef4eb9a84f814f22a7d03d9e874a09c Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Fri, 24 May 2024 16:15:04 +0200
Subject: [PATCH 16/19] Added native min os version blocking
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
---
build/macOS/distribution.xml | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/build/macOS/distribution.xml b/build/macOS/distribution.xml
index 773321da3..dc93628f8 100644
--- a/build/macOS/distribution.xml
+++ b/build/macOS/distribution.xml
@@ -7,15 +7,20 @@
+
+
+
From f66367d3425c570386dc7a91ddba707b58529b0f Mon Sep 17 00:00:00 2001
From: paulober <44974737+paulober@users.noreply.github.com>
Date: Fri, 24 May 2024 19:20:39 +0200
Subject: [PATCH 17/19] Integrate argument array to remove duplicate code
Signed-off-by: paulober <44974737+paulober@users.noreply.github.com>
---
script/pkgmacos | 42 ++++++++++++++++++++----------------------
1 file changed, 20 insertions(+), 22 deletions(-)
diff --git a/script/pkgmacos b/script/pkgmacos
index 7ffdea324..38103277e 100755
--- a/script/pkgmacos
+++ b/script/pkgmacos
@@ -58,8 +58,8 @@ fi
# gh-binary paths
bin_path="/bin/gh"
-arm64_bin="dist/macos_darwin_arm64$bin_path"
-amd64_bin="dist/macos_darwin_amd64_v1$bin_path"
+arm64_bin="./dist/macos_darwin_arm64$bin_path"
+amd64_bin="./dist/macos_darwin_amd64_v1$bin_path"
# payload paths
payload_root="pkg_payload"
payload_local_bin="${payload_root}/usr/local/bin"
@@ -93,37 +93,35 @@ build_pkg() {
--identifier "com.github.cli" \
--version "$tag_name" \
--install-location "/" \
- "dist/com.github.cli.pkg"
+ "./dist/com.github.cli.pkg"
# setup resources
- mkdir -p "build/macOS/resources"
- cp "LICENSE" "build/macOS/resources"
+ mkdir -p "./build/macOS/resources"
+ cp "LICENSE" "./build/macOS/resources"
- # build distribution
+ PRODUCTBUILD_ARGS=()
+
+ # include signing if developer id is set
if [ -n "$APPLE_DEVELOPER_INSTALLER_ID" ]; then
- # build and sign production package with license
- productbuild \
- --distribution "./build/macOS/distribution.xml" \
- --resources "./build/macOS/resources" \
- --package-path "./dist" \
- --timestamp \
- --sign "${APPLE_DEVELOPER_INSTALLER_ID?}" \
- "./dist/gh_${tag_name}_macOS_universal.pkg"
+ PRODUCTBUILD_ARGS+=("--timestamp")
+ PRODUCTBUILD_ARGS+=("--sign")
+ PRODUCTBUILD_ARGS+=("${APPLE_DEVELOPER_INSTALLER_ID}")
else
echo "skipping macOS pkg code-signing; APPLE_DEVELOPER_INSTALLER_ID not set" >&2
-
- # build production package with license without signing
- productbuild \
- --distribution "./build/macOS/distribution.xml" \
- --resources "./build/macOS/resources" \
- --package-path "./dist" \
- "./dist/gh_${tag_name}_macOS_universal.pkg"
fi
+
+ # build distribution
+ productbuild \
+ --distribution "./build/macOS/distribution.xml" \
+ --resources "./build/macOS/resources" \
+ --package-path "./dist" \
+ "${PRODUCTBUILD_ARGS[@]}" \
+ "./dist/gh_${tag_name}_macOS_universal.pkg"
}
cleanup() {
# remove temp installer so it does not get uploaded
- rm -f "dist/com.github.cli.pkg"
+ rm -f "./dist/com.github.cli.pkg"
}
trap cleanup EXIT
From 279d53af987edf231767142be967f8003da7397e Mon Sep 17 00:00:00 2001
From: Andy Feller
Date: Fri, 24 May 2024 15:09:40 -0400
Subject: [PATCH 18/19] Remove `v` prefix when `pkgmacos` is called
Existing Mac OS release artifacts use the tag name / version in the file name but drop the `v` prefix. This does the same for the Mac OS installer.
---
script/pkgmacos | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/script/pkgmacos b/script/pkgmacos
index 38103277e..a5c9134f1 100755
--- a/script/pkgmacos
+++ b/script/pkgmacos
@@ -30,7 +30,7 @@ while [ $# -gt 0 ]; do
exit 1
;;
* )
- tag_name="$1"
+ tag_name="${1#v}"
shift 1
;;
esac
From bdc40a00d40fb6f5ff23a48d8812b40638a18a13 Mon Sep 17 00:00:00 2001
From: Andy Feller
Date: Fri, 24 May 2024 15:26:37 -0400
Subject: [PATCH 19/19] Update readme about MacOS pkg
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 6e0c7de6a..f637eabcf 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ If you are a hubber and are interested in shipping new commands for the CLI, che
### macOS
-`gh` is available via [Homebrew][], [MacPorts][], [Conda][], [Spack][], [Webi][], and as a downloadable binary from the [releases page][].
+`gh` is available via [Homebrew][], [MacPorts][], [Conda][], [Spack][], [Webi][], and as a downloadable binary including Mac OS installer `.pkg` from the [releases page][].
#### Homebrew