44 workflow_dispatch :
55 inputs :
66 version :
7- description : ' Version to release'
7+ description : ' Version number for this release'
88 required : true
99 dry_run :
10- description : ' Run in dry-run mode (do not push to CocoaPods) '
10+ description : ' Test workflow without publishing to CocoaPods'
1111 type : boolean
1212 default : false
1313 required : false
14- skip_tag :
15- description : ' Skip creating a new tag (publish from current commit) '
14+ publish_only :
15+ description : ' Publish to CocoaPods without version updates or tagging '
1616 type : boolean
1717 default : false
1818 required : false
@@ -53,15 +53,18 @@ jobs:
5353 done
5454
5555 - name : Update version in podspec
56+ if : ${{ !github.event.inputs.publish_only }}
5657 run : sed -i '' 's/s.version = "[^"]*"/s.version = "${{ github.event.inputs.version }}"/' KSCrash.podspec
5758
5859 - name : Update version in source code
60+ if : ${{ !github.event.inputs.publish_only }}
5961 run : |
6062 formatted_version_number=$(echo "${{ github.event.inputs.version }}" | awk -F. '{printf("%d.%02d%02d\n", $1, $2, $3)}')
6163 sed -i '' 's/const double KSCrashFrameworkVersionNumber = [^;]*/const double KSCrashFrameworkVersionNumber = '"$formatted_version_number"'/' Sources/KSCrashRecording/KSCrash.m
6264 sed -i '' 's/const unsigned char KSCrashFrameworkVersionString\[\] = "[^"]*"/const unsigned char KSCrashFrameworkVersionString[] = "${{ github.event.inputs.version }}"/' Sources/KSCrashRecording/KSCrash.m
6365
6466 - name : Update README
67+ if : ${{ !github.event.inputs.publish_only }}
6568 run : |
6669 # Update SPM version
6770 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
8083
8184 - name : Commit version update
8285 id : commit_version
86+ if : ${{ !github.event.inputs.publish_only }}
8387 run : |
8488 git config --global user.name 'github-actions[bot]'
8589 git config --global user.email 'github-actions[bot]@users.noreply.github.com'
9599
96100 - name : Create git tag
97101 id : create_tag
98- if : ${{ !github.event.inputs.skip_tag }}
102+ if : ${{ !github.event.inputs.publish_only }}
99103 run : |
100104 if [[ "${{ github.event.inputs.dry_run }}" == "true" ]]; then
101105 TAG_NAME="${{ github.event.inputs.version }}-dryrun"
@@ -107,10 +111,10 @@ jobs:
107111 git push origin $TAG_NAME
108112 echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
109113
110- - name : Skip creating tag
111- if : ${{ github.event.inputs.skip_tag }}
114+ - name : Skip version update and tagging
115+ if : ${{ github.event.inputs.publish_only }}
112116 run : |
113- echo "Skipping tag creation - using current commit for release "
117+ echo "Publishing to CocoaPods only - skipping version update, commit and tag creation "
114118 echo "tag_name=" >> $GITHUB_OUTPUT
115119
116120 - name : Publish to CocoaPods
@@ -122,12 +126,12 @@ jobs:
122126 - name : Skip publishing
123127 if : ${{ github.event.inputs.dry_run }}
124128 run : |
125- echo "Publishing skipped - running in dry-run mode"
129+ echo "Publishing to CocoaPods skipped - running in dry-run mode"
126130
127131 rollback :
128132 runs-on : macos-15
129133 needs : release
130- if : failure()
134+ if : failure() && !github.event.inputs.publish_only
131135 steps :
132136 - name : Checkout code
133137 uses : actions/checkout@v2
@@ -139,7 +143,6 @@ jobs:
139143 git fetch --tags
140144
141145 - name : Delete git tag locally
142- if : ${{ !github.event.inputs.skip_tag }}
143146 run : |
144147 # Use tag from outputs or construct it
145148 if [[ -n "${{ needs.release.outputs.tag_name }}" ]]; then
@@ -154,7 +157,6 @@ jobs:
154157 echo "TAG_TO_DELETE=$TAG_TO_DELETE" >> $GITHUB_ENV
155158
156159 - name : Delete git tag remotely
157- if : ${{ !github.event.inputs.skip_tag }}
158160 run : |
159161 git push --delete origin ${{ env.TAG_TO_DELETE }} || echo "Tag not found on remote"
160162
0 commit comments