Skip to content

Commit 3ea9e6d

Browse files
committed
Fix release workflow podspec sync [skip-release]
1 parent a6338de commit 3ea9e6d

3 files changed

Lines changed: 12 additions & 14 deletions

File tree

.github/workflows/release-sectionui-skill.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
echo "prepare_only=false" >> "$GITHUB_OUTPUT"
108108
fi
109109
elif [[ "${GITHUB_REF_TYPE}" == "branch" ]]; then
110-
if git log -1 --pretty=%B | grep -q '^Release SectionUI '; then
110+
if git log -1 --pretty=%B | grep -q '\[skip-release\]'; then
111111
echo "Release version commit detected; skipping auto-increment to avoid a release loop."
112112
echo "prepare_only=skip" >> "$GITHUB_OUTPUT"
113113
echo "release_tag=0.0.0" >> "$GITHUB_OUTPUT"
@@ -156,14 +156,14 @@ jobs:
156156
shell: bash
157157
run: |
158158
python3 SectionUI.skills/scripts/sync_release_version.py --version "$VERSION"
159-
perl -0pi -e "s/s\.version\s*=\s*'[^']+'/s.version = '$ENV{VERSION}'/g" SectionKit2.podspec SectionUI.podspec
160-
perl -0pi -e "s/s\.dependency 'SectionKit2', '>= [^']+'/s.dependency 'SectionKit2', '>= $ENV{VERSION}'/" SectionUI.podspec
159+
ruby -i -pe "gsub(/s\.version\s*=\s*'[^']+'/, \"s.version = '#{ENV.fetch('VERSION')}'\")" SectionKit2.podspec SectionUI.podspec
160+
ruby -i -pe "gsub(/s\.dependency 'SectionKit2', '>= [^']+'/, \"s.dependency 'SectionKit2', '>= #{ENV.fetch('VERSION')}'\")" SectionUI.podspec
161161
162162
git diff --check
163163
git config user.name "github-actions[bot]"
164164
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
165165
git add SectionKit2.podspec SectionUI.podspec SectionUI.skills/SKILL.md SectionUI.skills/UPDATE.md SectionUI.skills/VERSION.md
166-
git commit -m "Release SectionUI $VERSION"
166+
git commit -m "Release SectionUI $VERSION [skip-release]"
167167
git tag "$RELEASE_TAG"
168168
git push origin "HEAD:${GITHUB_REF_NAME}" "$RELEASE_TAG"
169169
@@ -186,11 +186,9 @@ jobs:
186186
shell: bash
187187
run: |
188188
version="${{ steps.release.outputs.version }}"
189-
sectionkit2_version=$(ruby -rcocoapods -e "spec = eval(File.read('SectionKit2.podspec')); puts spec.version" 2>/dev/null || true)
190-
sectionui_version=$(ruby -rcocoapods -e "spec = eval(File.read('SectionUI.podspec')); puts spec.version" 2>/dev/null || true)
191-
sectionui_dependency=$(ruby -rcocoapods -e "spec = eval(File.read('SectionUI.podspec')); puts spec.dependencies.find { |d| d.name == 'SectionKit2' }.requirement" 2>/dev/null || true)
192-
sectionkit2_source_tag=$(ruby -rcocoapods -e "spec = eval(File.read('SectionKit2.podspec')); puts spec.source[:tag]" 2>/dev/null || true)
193-
sectionui_source_tag=$(ruby -rcocoapods -e "spec = eval(File.read('SectionUI.podspec')); puts spec.source[:tag]" 2>/dev/null || true)
189+
sectionkit2_version=$(ruby -ne "puts \$1 if /s\.version\s*=\s*'([^']+)'/" SectionKit2.podspec)
190+
sectionui_version=$(ruby -ne "puts \$1 if /s\.version\s*=\s*'([^']+)'/" SectionUI.podspec)
191+
sectionui_dependency=$(ruby -ne "puts \$1 if /s\.dependency 'SectionKit2', '([^']+)'/" SectionUI.podspec)
194192
195193
if [[ "$sectionkit2_version" != "$version" ]]; then
196194
echo "::error::SectionKit2.podspec version '$sectionkit2_version' does not match tag version '$version'"
@@ -204,8 +202,8 @@ jobs:
204202
echo "::error::SectionUI dependency on SectionKit2 is '$sectionui_dependency', expected '>= $version'"
205203
exit 1
206204
fi
207-
if [[ "$sectionkit2_source_tag" != "$version" || "$sectionui_source_tag" != "$version" ]]; then
208-
echo "::error::Podspec source tags must match bare version '$version' because CocoaPods fetches s.source[:tag]. Got SectionKit2='$sectionkit2_source_tag', SectionUI='$sectionui_source_tag'."
205+
if ! grep -q ':tag => "#{s.version}"' SectionKit2.podspec || ! grep -q ':tag => "#{s.version}"' SectionUI.podspec; then
206+
echo "::error::Podspec source tags must use #{s.version} so CocoaPods fetches the release tag."
209207
exit 1
210208
fi
211209
if ! git rev-parse "$version^{commit}" >/dev/null 2>&1; then

SectionKit2.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'SectionKit2'
3-
s.version = '{VERSION}'
3+
s.version = '2.5.6'
44
s.summary = '动态表单框架'
55
s.homepage = "https://github.com/linhay/SectionKit"
66
s.license = { :type => 'Apache', :file => 'LICENSE' }

SectionUI.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'SectionUI'
3-
s.version = '{VERSION}'
3+
s.version = '2.5.6'
44
s.summary = '动态表单框架'
55
s.homepage = "https://github.com/linhay/SectionKit"
66
s.license = { :type => 'Apache', :file => 'LICENSE' }
@@ -11,7 +11,7 @@ Pod::Spec.new do |s|
1111

1212
s.platform = :ios
1313
s.ios.deployment_target = "13.0"
14-
s.dependency 'SectionKit2', '>= {VERSION}'
14+
s.dependency 'SectionKit2', '>= 2.5.6'
1515

1616
s.source_files = ["Sources/SectionUI/**/*.{swift,h}"]
1717
end

0 commit comments

Comments
 (0)