diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..6879d42 --- /dev/null +++ b/Package.swift @@ -0,0 +1,24 @@ +// swift-tools-version: 5.10 +// The swift-tools-version declares the minimum version of Swift required to build this package. +import PackageDescription + +let version = "0.0.2" +let moduleName = "Citiwastelib" +let checksum = "" + +let package = Package( + name: moduleName, + products: [ + .library( + name: moduleName, + targets: [moduleName] + ) + ], + targets: [ + .binaryTarget( + name: moduleName, + url: "https://github.com/albetoetecnia/CitiwastelibsDistribution/releases/download/\(version)/\(moduleName).xcframework.zip", + checksum: checksum + ) + ] +) diff --git a/Sources/CitiwastelibsDistribution/CitiwastelibsDistribution.swift b/Sources/CitiwastelibsDistribution/CitiwastelibsDistribution.swift new file mode 100644 index 0000000..08b22b8 --- /dev/null +++ b/Sources/CitiwastelibsDistribution/CitiwastelibsDistribution.swift @@ -0,0 +1,2 @@ +// The Swift Programming Language +// https://docs.swift.org/swift-book diff --git a/Tests/CitiwastelibsDistributionTests/CitiwastelibsDistributionTests.swift b/Tests/CitiwastelibsDistributionTests/CitiwastelibsDistributionTests.swift new file mode 100644 index 0000000..8c6c251 --- /dev/null +++ b/Tests/CitiwastelibsDistributionTests/CitiwastelibsDistributionTests.swift @@ -0,0 +1,12 @@ +import XCTest +@testable import CitiwastelibsDistribution + +final class CitiwastelibsDistributionTests: XCTestCase { + func testExample() throws { + // XCTest Documentation + // https://developer.apple.com/documentation/xctest + + // Defining Test Cases and Test Methods + // https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods + } +} diff --git a/prepare_package.sh b/prepare_package.sh new file mode 100644 index 0000000..154ed20 --- /dev/null +++ b/prepare_package.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# prepare_package.sh +# Citiwastelib +# +# Created by Alberto Bailac Moreno on 1/7/24. +# + +# Check for arguments +if [ $# -eq 0 ]; then + echo "No arguments provided. First argument has to be version, e.g. '1.8.1'" + exit 1 +fi + +# 1. Get params +NEW_VERSION=$1 +FRAMEWORK_NAME=$2 + +# 2. Calculate checksum and store it +echo "calculate new checksum" +NEW_CHECKSUM=$(swift package compute-checksum $FRAMEWORK_NAME.xcframework.zip) +echo "print out new shasum for convenience reasons" +echo "New checksum is $NEW_CHECKSUM" + +# 3. Replace all data from Package.swift manifest +echo "replace name module information in package manifest" +sed -E -i '' 's/let moduleName = ".+"/let moduleName = "'$FRAMEWORK_NAME\"/ Package.swift +echo "replace version information in package manifest" +sed -E -i '' 's/let version = ".+"/let version = "'$NEW_VERSION\"/ Package.swift +echo "replace checksum information in package manifest" +sed -E -i '' 's/let checksum = ".+"/let checksum = "'$NEW_CHECKSUM\"/ Package.swift + +# 4. Print new content of manifest +echo "print out package manifest for convenience reasons" +cat Package.swift + +# 5. Commit all data without the XCfrmework +echo "git commit all without framework and push" +git add --all -- :!$FRAMEWORK_NAME.xcframework.zip +git commit -m "New $FRAMEWORK_NAME version $NEW_VERSION" +git push + +# 6. Pusblish a new release with the same version of the repository A, and attach XCFramework in the Release metadata +echo "Releasing the new version" +gh release create "$NEW_VERSION" --generate-notes "./CitiwastelibDistribution/$FRAMEWORK_NAME.xcframework.zip" + +# 7. Remove zip of XCFramework +#echo "delete downloaded zip file" +#rm "./CitiwastelibDistribution/$FRAMEWORK_NAME.xcframework.zip"