Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
albetoetecnia committed Jul 1, 2024
0 parents commit f6b7592
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
24 changes: 24 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -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
)
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The Swift Programming Language
// https://docs.swift.org/swift-book
Original file line number Diff line number Diff line change
@@ -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
}
}
49 changes: 49 additions & 0 deletions prepare_package.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit f6b7592

Please sign in to comment.