From 6311b8b32a03b10b99df7f92feadd25ec2217aa0 Mon Sep 17 00:00:00 2001 From: Fedor Korotkov Date: Tue, 28 Feb 2023 12:29:22 -0500 Subject: [PATCH] Pack in app structure (#429) * Pack release in app-structure * Fixed install block * Build pkg --- .ci/create-pkg.sh | 11 +++++-- .ci/pkg/scripts/postinstall | 8 +++++ .cirrus.yml | 4 +-- .goreleaser.yml | 28 ++++++++++-------- .run/sign debug.run.xml | 2 +- Resources/embedded.provisionprofile | Bin 0 -> 12309 bytes ...art.entitlements => tart-dev.entitlements} | 0 Resources/tart-prod.entitlements | 10 +++++++ gon.hcl | 2 +- 9 files changed, 46 insertions(+), 19 deletions(-) create mode 100755 .ci/pkg/scripts/postinstall create mode 100644 Resources/embedded.provisionprofile rename Resources/{tart.entitlements => tart-dev.entitlements} (100%) create mode 100644 Resources/tart-prod.entitlements diff --git a/.ci/create-pkg.sh b/.ci/create-pkg.sh index 660f530..f5a4f9f 100755 --- a/.ci/create-pkg.sh +++ b/.ci/create-pkg.sh @@ -4,8 +4,13 @@ set -e export VERSION="${CIRRUS_TAG:-0}" -mkdir -p .ci/pkg/ -cp .build/arm64-apple-macosx/debug/tart .ci/pkg/ -pkgbuild --root .ci/pkg --version $VERSION --install-location /usr/local/bin/ --identifier com.github.cirruslabs.tart --sign "Developer ID Installer: Cirrus Labs, Inc. (9M2P8L4D89)" "./dist/Tart-$VERSION.pkg" +mkdir -p .ci/pkg/Tart.app/Contents/MacOS +cp .build/arm64-apple-macosx/debug/tart .ci/pkg/Tart.app/Contents/MacOS/tart +cp Resources/embedded.provisionprofile .ci/pkg/Tart.app/Contents/embedded.provisionprofile +pkgbuild --root .ci/pkg/Tart.app --identifier com.github.cirruslabs.tart --version $VERSION \ + --scripts .ci/pkg/scripts \ + --install-location "/Library/Application Support/Tart/Tart.app" \ + --sign "Developer ID Installer: Cirrus Labs, Inc. (9M2P8L4D89)" \ + "./dist/Tart-$VERSION.pkg" xcrun notarytool submit "./dist/Tart-$VERSION.pkg" --keychain-profile "notarytool" --wait xcrun stapler staple "./dist/Tart-$VERSION.pkg" diff --git a/.ci/pkg/scripts/postinstall b/.ci/pkg/scripts/postinstall new file mode 100755 index 0000000..a29669d --- /dev/null +++ b/.ci/pkg/scripts/postinstall @@ -0,0 +1,8 @@ +#!/bin/sh + +set -e + +echo "#!/bin/sh" > /usr/local/bin/tart +echo "exec '$2/Contents/MacOS/tart' \"\$@\"" >> /usr/local/bin/tart + +chmod +x /usr/local/bin/tart diff --git a/.cirrus.yml b/.cirrus.yml index 62b1dfa..c6d75f9 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,7 +11,7 @@ task: integration_test_script: # Build Tart - swift build - - codesign --sign - --entitlements Resources/tart.entitlements --force .build/debug/tart + - codesign --sign - --entitlements Resources/tart-dev.entitlements --force .build/debug/tart - export PATH=$(pwd)/.build/arm64-apple-macosx/debug:$PATH # Run integration tests - cd integration-tests @@ -43,7 +43,7 @@ task: macos_instance: image: ghcr.io/cirruslabs/macos-ventura-xcode:latest build_script: swift build --product tart - sign_script: codesign --sign - --entitlements Resources/tart.entitlements --force .build/debug/tart + sign_script: codesign --sign - --entitlements Resources/tart-dev.entitlements --force .build/debug/tart binary_artifacts: path: .build/debug/tart diff --git a/.goreleaser.yml b/.goreleaser.yml index 921fded..bd94a26 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,10 @@ project_name: tart +before: + hooks: + - .ci/set-version.sh + - swift build -c debug --product tart + builds: - builder: prebuilt goos: @@ -13,17 +18,15 @@ builds: - gon gon.hcl - .ci/create-pkg.sh -before: - hooks: - - .ci/set-version.sh - - swift build -c debug --product tart - archives: - - id: binary - format: binary - name_template: "{{ .ProjectName }}" - - id: regular - name_template: "{{ .ProjectName }}" + - name_template: "{{ .ProjectName }}" + files: + - src: Resources/embedded.provisionprofile + dst: Tart.app/Contents + strip_parent: true + - src: ".build/arm64-apple-macosx/debug/tart" + dst: Tart.app/Contents/MacOS + strip_parent: true release: prerelease: auto @@ -32,8 +35,6 @@ release: brews: - name: tart - ids: - - regular tap: owner: cirruslabs name: homebrew-cli @@ -44,6 +45,9 @@ brews: skip_upload: auto dependencies: - "cirruslabs/cli/softnet" + install: | + libexec.install Dir["*"] + bin.write_exec_script "#{libexec}/Tart.app/Contents/MacOS/tart" custom_block: | depends_on :macos => :monterey diff --git a/.run/sign debug.run.xml b/.run/sign debug.run.xml index 176f982..19d2cd6 100644 --- a/.run/sign debug.run.xml +++ b/.run/sign debug.run.xml @@ -1,6 +1,6 @@ -