From a1412a475e1ca07599e0ddc962cfd7dcda8e0511 Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Fri, 24 Feb 2023 21:17:45 +0100 Subject: [PATCH 01/10] Add binary target to package definition --- Makefile | 25 +++++++++++++++++++------ Package.swift | 5 +++++ Tools/get-version | 5 +++++ Tools/info-macos.json.template | 15 +++++++++++++++ Tools/update-artifact-bundle.sh | 15 +++++++++++++++ release.sh | 13 +++++++++++++ 6 files changed, 72 insertions(+), 6 deletions(-) create mode 100755 Tools/get-version create mode 100644 Tools/info-macos.json.template create mode 100755 Tools/update-artifact-bundle.sh diff --git a/Makefile b/Makefile index 537d3ec7..b98e412a 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,20 @@ PREFIX?=/usr/local -TEMPORARY_FOLDER=./tmp_portable_licenseplist +TEMPORARY_FOLDER=./tmp_licenseplist -build: +VERSION_STRING=$(shell ./Tools/get-version) +LICENSE_PATH="$(shell pwd)/LICENSE" + +ARTIFACT_BUNDLE_PATH=$(TEMPORARY_FOLDER)/LicensePlistBinary.artifactbundle + +clean: + rm -rf "$(TEMPORARY_FOLDER)" + swift package clean + +build: clean swift build --disable-sandbox -c release -build_portable: +build_portable: clean swift build --disable-sandbox -c release --arch x86_64 --arch arm64 test: @@ -14,9 +23,6 @@ test: lint: swiftlint -clean: - swift package clean - xcode: swift package generate-xcodeproj @@ -30,3 +36,10 @@ portable_zip: build_portable cp -f "LICENSE" "$(TEMPORARY_FOLDER)" (cd $(TEMPORARY_FOLDER); zip -r - LICENSE license-plist) > "./portable_licenseplist.zip" rm -r "$(TEMPORARY_FOLDER)" + +spm_artifactbundle_macos: build + mkdir -p "$(ARTIFACT_BUNDLE_PATH)/license-plist-$(VERSION_STRING)-macos/bin" + sed 's/__VERSION__/$(VERSION_STRING)/g' Tools/info-macos.json.template > "$(ARTIFACT_BUNDLE_PATH)/info.json" + cp -f ".build/release/license-plist" "$(ARTIFACT_BUNDLE_PATH)/license-plist-$(VERSION_STRING)-macos/bin" + cp -f "$(LICENSE_PATH)" "$(ARTIFACT_BUNDLE_PATH)" + (cd "$(TEMPORARY_FOLDER)"; zip -yr - "LicensePlistBinary.artifactbundle") > "./LicensePlistBinary-macos.artifactbundle.zip" diff --git a/Package.swift b/Package.swift index 304d353f..a5952ddc 100644 --- a/Package.swift +++ b/Package.swift @@ -48,5 +48,10 @@ let package = Package( "XcodeProjects", ] ), + .binaryTarget( + name: "LicensePlistBinary", + url: "https://github.com/mono0926/LicensePlist/releases/download/3.24.1/LicensePlistBinary-macos.artifactbundle.zip", + checksum: "65f75ec79538c92941cacfaa09b04991947024613760070a1b4d6bd88512a3ad" + ) ] ) diff --git a/Tools/get-version b/Tools/get-version new file mode 100755 index 00000000..cf8d0fa6 --- /dev/null +++ b/Tools/get-version @@ -0,0 +1,5 @@ +#!/bin/bash + +set -euo pipefail + +cat Sources/LicensePlistCore/Consts.swift | grep "version =" | awk -F '"' '{print $2}' | xargs \ No newline at end of file diff --git a/Tools/info-macos.json.template b/Tools/info-macos.json.template new file mode 100644 index 00000000..63412b90 --- /dev/null +++ b/Tools/info-macos.json.template @@ -0,0 +1,15 @@ +{ + "schemaVersion": "1.0", + "artifacts": { + "swiftlint": { + "version": "__VERSION__", + "type": "executable", + "variants": [ + { + "path": "license-plist__VERSION__-macos/bin/license-plist", + "supportedTriples": ["x86_64-apple-macosx", "arm64-apple-macosx"] + } + ] + } + } +} diff --git a/Tools/update-artifact-bundle.sh b/Tools/update-artifact-bundle.sh new file mode 100755 index 00000000..848672f4 --- /dev/null +++ b/Tools/update-artifact-bundle.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -euo pipefail + +readonly version="$1" +readonly artifactbundle="LicensePlistBinary-macos.artifactbundle.zip" +readonly checksum="$(shasum -a 256 "$artifactbundle" | cut -d " " -f1 | xargs)" + +sed -i '' \ + "s/.*\/releases\/download\/.*/ url: \"https:\/\/github.com\/mono0926\/LicensePlist\/releases\/download\/$version\/LicensePlistBinary-macos\.artifactbundle\.zip\",/g" \ + Package.swift + +sed -i '' \ + "s/.*checksum.*/ checksum: \"$checksum\"/g" \ + Package.swift diff --git a/release.sh b/release.sh index 8178d080..629dc982 100755 --- a/release.sh +++ b/release.sh @@ -66,6 +66,19 @@ github-release upload \ rm $lib_name.zip +# Artifact bundle +binary_artifact="LicensePlistBinary-macos.artifactbundle.zip" +make spm_artifactbundle_macos +./Tools/update-artifact-bundle.sh "${tag}" +github-release upload \ + --user mono0926 \ + --repo LicensePlist \ + --tag $tag \ + --name $binary_artifact \ + --file $binary_artifact + +rm $binary_artifact + # CocoaPods make portable_zip portable_zip_name="portable_licenseplist.zip" From 03629c3573ab0be54255b9575430485cd897d22e Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Fri, 24 Feb 2023 21:47:30 +0100 Subject: [PATCH 02/10] Fix artifact name --- Tools/info-macos.json.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/info-macos.json.template b/Tools/info-macos.json.template index 63412b90..e4f476d7 100644 --- a/Tools/info-macos.json.template +++ b/Tools/info-macos.json.template @@ -1,7 +1,7 @@ { "schemaVersion": "1.0", "artifacts": { - "swiftlint": { + "license-plist": { "version": "__VERSION__", "type": "executable", "variants": [ From ba1621f7278d33e8122a56484159c54bab7078ce Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Fri, 24 Feb 2023 22:04:51 +0100 Subject: [PATCH 03/10] Fix a typo in bundle artifact metadata template --- Tools/info-macos.json.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/info-macos.json.template b/Tools/info-macos.json.template index e4f476d7..40c0921e 100644 --- a/Tools/info-macos.json.template +++ b/Tools/info-macos.json.template @@ -6,7 +6,7 @@ "type": "executable", "variants": [ { - "path": "license-plist__VERSION__-macos/bin/license-plist", + "path": "license-plist-__VERSION__-macos/bin/license-plist", "supportedTriples": ["x86_64-apple-macosx", "arm64-apple-macosx"] } ] From a2eae4795e2e6c9096a9da3bfbb99537155f9120 Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Fri, 24 Feb 2023 22:16:54 +0100 Subject: [PATCH 04/10] Add new line to get-version script --- Tools/get-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tools/get-version b/Tools/get-version index cf8d0fa6..6f782e8d 100755 --- a/Tools/get-version +++ b/Tools/get-version @@ -2,4 +2,4 @@ set -euo pipefail -cat Sources/LicensePlistCore/Consts.swift | grep "version =" | awk -F '"' '{print $2}' | xargs \ No newline at end of file +cat Sources/LicensePlistCore/Consts.swift | grep "version =" | awk -F '"' '{print $2}' | xargs From 04b8a73ec6088d6fdac4d2e4d1751c8ba0d28504 Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Fri, 24 Feb 2023 22:37:07 +0100 Subject: [PATCH 05/10] Add commit command to the script --- release.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/release.sh b/release.sh index 629dc982..f04dd815 100755 --- a/release.sh +++ b/release.sh @@ -18,6 +18,15 @@ echo "Token: '${token}'" filename="${tag}.tar.gz" echo "Filename: '${filename}'" +# Prepare artifact bundle +binary_artifact="LicensePlistBinary-macos.artifactbundle.zip" +make spm_artifactbundle_macos +./Tools/update-artifact-bundle.sh "${tag}" + +# Commit changes +git add Package.swift +git commit -m "release ${tag}" + # Push tag git tag $tag git push origin $tag @@ -66,10 +75,7 @@ github-release upload \ rm $lib_name.zip -# Artifact bundle -binary_artifact="LicensePlistBinary-macos.artifactbundle.zip" -make spm_artifactbundle_macos -./Tools/update-artifact-bundle.sh "${tag}" +# Upload artifact bundle github-release upload \ --user mono0926 \ --repo LicensePlist \ From d954974832c418b8be7fa4f1ef3302e55fab33e4 Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Fri, 24 Feb 2023 22:38:19 +0100 Subject: [PATCH 06/10] release 3.24.1 --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index a5952ddc..c28b7e00 100644 --- a/Package.swift +++ b/Package.swift @@ -51,7 +51,7 @@ let package = Package( .binaryTarget( name: "LicensePlistBinary", url: "https://github.com/mono0926/LicensePlist/releases/download/3.24.1/LicensePlistBinary-macos.artifactbundle.zip", - checksum: "65f75ec79538c92941cacfaa09b04991947024613760070a1b4d6bd88512a3ad" + checksum: "16ec69bf7d0515f8be3970201f13730d39ad55fffd40c7765f40193eedf54e83" ) ] ) From 95637e13efd67deb05c00ba371c2f6e77d19cf39 Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Fri, 24 Feb 2023 22:41:32 +0100 Subject: [PATCH 07/10] Revert "release 3.24.1" This reverts commit d954974832c418b8be7fa4f1ef3302e55fab33e4. --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index c28b7e00..a5952ddc 100644 --- a/Package.swift +++ b/Package.swift @@ -51,7 +51,7 @@ let package = Package( .binaryTarget( name: "LicensePlistBinary", url: "https://github.com/mono0926/LicensePlist/releases/download/3.24.1/LicensePlistBinary-macos.artifactbundle.zip", - checksum: "16ec69bf7d0515f8be3970201f13730d39ad55fffd40c7765f40193eedf54e83" + checksum: "65f75ec79538c92941cacfaa09b04991947024613760070a1b4d6bd88512a3ad" ) ] ) From fd795b40ef35ffae4ec6e76be55a2b0424676a62 Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Fri, 24 Feb 2023 22:42:09 +0100 Subject: [PATCH 08/10] Update release script --- release.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/release.sh b/release.sh index f04dd815..ed452dfc 100755 --- a/release.sh +++ b/release.sh @@ -23,9 +23,10 @@ binary_artifact="LicensePlistBinary-macos.artifactbundle.zip" make spm_artifactbundle_macos ./Tools/update-artifact-bundle.sh "${tag}" -# Commit changes +# Push updated binary target definition git add Package.swift git commit -m "release ${tag}" +git push origin HEAD # Push tag git tag $tag From 4ce895d37bae3b3c69e592cae2dd6a6c3524da2d Mon Sep 17 00:00:00 2001 From: Vladimir Vlasov Date: Fri, 24 Feb 2023 22:42:27 +0100 Subject: [PATCH 09/10] release 3.24.1 --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index a5952ddc..c28b7e00 100644 --- a/Package.swift +++ b/Package.swift @@ -51,7 +51,7 @@ let package = Package( .binaryTarget( name: "LicensePlistBinary", url: "https://github.com/mono0926/LicensePlist/releases/download/3.24.1/LicensePlistBinary-macos.artifactbundle.zip", - checksum: "65f75ec79538c92941cacfaa09b04991947024613760070a1b4d6bd88512a3ad" + checksum: "16ec69bf7d0515f8be3970201f13730d39ad55fffd40c7765f40193eedf54e83" ) ] ) From ea61dce95c148dbdfbfe344ec93db07895b114af Mon Sep 17 00:00:00 2001 From: mono Date: Thu, 9 Mar 2023 15:53:33 +0900 Subject: [PATCH 10/10] Update LicensePlistBinary checksum --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index c28b7e00..79c4933f 100644 --- a/Package.swift +++ b/Package.swift @@ -51,7 +51,7 @@ let package = Package( .binaryTarget( name: "LicensePlistBinary", url: "https://github.com/mono0926/LicensePlist/releases/download/3.24.1/LicensePlistBinary-macos.artifactbundle.zip", - checksum: "16ec69bf7d0515f8be3970201f13730d39ad55fffd40c7765f40193eedf54e83" + checksum: "a9609355bc9a72f6e610a96cfaa3e828329564d6eda9b08cfcabc75a90af7275" ) ] )