diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b643211ac..32becfc95 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,6 +44,23 @@ jobs: sed -i '' 's/const double KSCrashFrameworkVersionNumber = [^;]*/const double KSCrashFrameworkVersionNumber = '"$formatted_version_number"'/' Sources/KSCrashRecording/KSCrash.m sed -i '' 's/const unsigned char KSCrashFrameworkVersionString\[\] = "[^"]*"/const unsigned char KSCrashFrameworkVersionString[] = "${{ github.event.inputs.version }}"/' Sources/KSCrashRecording/KSCrash.m + - name: Update README + run: | + # Update SPM version + sed -i '' "s/\.package(url: \"https:\/\/github.com\/kstenerud\/KSCrash.git\", .upToNextMajor(from: \"[^\"]*\"))/\.package(url: \"https:\/\/github.com\/kstenerud\/KSCrash.git\", .upToNextMajor(from: \"${{ github.event.inputs.version }}\"))/" README.md + + # Update CocoaPods version + VERSION="${{ github.event.inputs.version }}" + if [[ "$VERSION" == *"-"* ]]; then + # It's a pre-release version, use the full version + sed -i '' "s/pod 'KSCrash'.*$/pod 'KSCrash', '~> $VERSION'/" README.md + else + # It's a release version, use major.minor + sed -i '' "s/pod 'KSCrash'.*$/pod 'KSCrash', '~> ${VERSION%.*}'/" README.md + fi + + echo "README.md updated with version ${{ github.event.inputs.version }}" + - name: Commit version update id: commit_version run: | @@ -94,8 +111,8 @@ jobs: - name: Pull latest changes run: | - echo "Pulling latest changes from release-action branch..." - git pull origin release-action + echo "Pulling latest changes for the current branch..." + git pull origin "$(git branch --show-current)" echo "Latest changes pulled successfully." - name: Revert version commit diff --git a/README.md b/README.md index a249b19ce..a30ffcef9 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Add the following to your `Package.swift` file: ```swift dependencies: [ - .package(url: "https://github.com/kstenerud/KSCrash.git", from: "2.0.0-alpha.2") + .package(url: "https://github.com/kstenerud/KSCrash.git", .upToNextMajor(from: "2.0.0-alpha.3")) ] ``` @@ -94,7 +94,7 @@ targets: [ 1. Add to your `Podfile`: ```ruby - pod 'KSCrash' + pod 'KSCrash', '~> 2.0.0-alpha.3' ``` 2. Run: