Merge pull request #1751 from thebluepotato/patch-2

Fix Package.swift
This commit is contained in:
Mayur Pawashe authored and GitHub committed 2021-02-05 15:43:44 -08:00
commit be3fb5caf2
3 files changed
+27 -6

No files matched your search

+19 -1
View File
@@ -52,6 +52,23 @@ if [ "$ACTION" = "" ] ; then
cd "$CONFIGURATION_BUILD_DIR/staging-spm"
#rm -rf "$CONFIGURATION_BUILD_DIR/Sparkle.xcarchive"
zip -rqyX -9 "../Sparkle-for-Swift-Package-Manager.zip" *
# GitHub actions set the CI environment variable to true
if [ "$CI" != true ]; then
# Get latest git tag
cd "$SRCROOT"
latest_git_tag=$(git describe --abbrev=0)
# Check semantic versioning
if [[ $latest_git_tag =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$ ]]; then
echo "Tag $latest_git_tag follows semantic versioning"
else
echo "ERROR: Tag $latest_git_tag does not follow semantic versioning! SPM will not be able to resolve the repository" >&2
exit 1
fi
else
# Dummy placeholder for CI test builds as we don't really need to update Package.swift for building and testing purposes
latest_git_tag="CI_BUILD"
fi
# Generate new Package manifest
cd "$CONFIGURATION_BUILD_DIR"
cp "$SRCROOT/Package.swift" "$CONFIGURATION_BUILD_DIR"
@@ -59,10 +76,11 @@ if [ "$ACTION" = "" ] ; then
# is equivalent to shasum -a 256 FILE
spm_checksum=$(swift package compute-checksum "Sparkle-for-Swift-Package-Manager.zip")
rm -rf ".build"
sed -E -i '' -e "/let version/ s/[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+/$CURRENT_PROJECT_VERSION/" -e "/let checksum/ s/[[:xdigit:]]{64}/$spm_checksum/" "Package.swift"
sed -E -i '' -e "/let tag/ s/\".+\"/\"$latest_git_tag\"/" -e "/let version/ s/\".+\"/\"$CURRENT_PROJECT_VERSION\"/" -e "/let checksum/ s/[[:xdigit:]]{64}/$spm_checksum/" "Package.swift"
cp "Package.swift" "$SRCROOT"
echo "Package.swift updated with the following values:"
echo "Version: $CURRENT_PROJECT_VERSION"
echo "Tag: $latest_git_tag"
echo "Checksum: $spm_checksum"
else
echo "warning: Xcode version $XCODE_VERSION_ACTUAL does not support computing checksums for Swift Packages. Please update the Package manifest manually."
+4 -4
View File
@@ -10,9 +10,11 @@ if [ "$commits_since_tag" -gt 0 ]; then
echo "Package.swift has not been committed and tag has not been moved."
else
# TODO: add sanity check to see if version is actually being updated or not?
read -p "Do you want to commit changes to Package.swift and force move tag '$latest_git_tag'? (required for Swift Package Manager release) " -n 1 -r
read -p "Do you want to commit changes to Package.swift and force move tag '$latest_git_tag'? (required for SPM release) [Y/n]" -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
if [[ $REPLY =~ ^[Nn]$ ]]; then
echo "Package.swift has not been committed and tag has not been moved."
else
long_message=$(git tag -n99 -l $latest_git_tag) # gets corresponding message
long_message=${long_message/$latest_git_tag} # trims tag name
long_message="$(echo -e "${long_message}" | sed -e 's/^[[:space:]]*//')" # trim leading whitespace
@@ -20,7 +22,5 @@ else
git commit -m "Update Package.swift"
git tag -fa $latest_git_tag -m "${long_message}"
echo "Package.swift committed and tag '$latest_git_tag' moved."
else
echo "Package.swift has not been committed and tag has not been moved."
fi
fi
+4 -1
View File
@@ -1,9 +1,12 @@
// swift-tools-version:5.3
import PackageDescription
// Version is technically not required here, SPM doesn't check
let version = "1.24.0"
// Tag is required to point towards the right asset. SPM requires the tag to follow semantic versioning to be able to resolve it.
let tag = "1.24.0"
let checksum = "a9ae129446739a685d2fb60b392606df020ee8e8d132dcc3a5959a8dd0775f35"
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(version)/Sparkle-for-Swift-Package-Manager.zip"
let url = "https://github.com/sparkle-project/Sparkle/releases/download/\(tag)/Sparkle-for-Swift-Package-Manager.zip"
let package = Package(
name: "Sparkle",