In a CI pipeline (Azure DevOPS) I would like to read the current version of a private Podspec. The content of my Podspec looks like this
Pod::Spec.new do |spec|
spec.name = 'ExampleShared'
spec.version = '1.0.2'
spec.homepage = 'https://example.com'
spec.source = { :git => 'https://dev.azure.com/example/ONE/_git/Cocoapods', :tag => '1.0.2'}
spec.authors = ''
spec.license = { :type => 'Commercial', :text => 'Copyright (c) ...' }
spec.summary = 'Some summary'
spec.vendored_frameworks = 'bin/ExampleShared/1.0.2/ExampleShared.xcframework'
spec.libraries = 'c++'
spec.ios.deployment_target = '12.4'
end
I tried to use Cocoapod command like pod spec cat
which writes the content above to the console or just directly using the Podspec along with some grep
and Regex, but I failed.
Only got to the point where I captured the line where I can get the version from, but I only really need the 1.0.2 value from that line.
This is my grep line
grep -o -E "spec\.version\s+=\s'([0-9\.]+)'" ExampleShared.podspec
which results in
spec.version = '1.0.2'
But as mentioned above I just need
1.0.2
as result.
How do I do that?