-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: add pod spec version check on release branch pushes (#88)
- Loading branch information
1 parent
01d10c4
commit 5c6a5c5
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Validate release | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'releases/**' | ||
|
||
jobs: | ||
versioncheck: | ||
runs-on: macos-latest | ||
name: Validate Versions | ||
steps: | ||
- name: Compare Podspec Version | ||
uses: actions/checkout@v2 | ||
- name: Run Version Check Script | ||
run: ./scripts/version-check.sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
readonly COCOAPOD_SPEC=Mux-Upload-SDK.podspec | ||
|
||
# Extracts the pod spec version in the form of a MAJOR.MINOR.PATCH string | ||
cocoapod_spec_version=$(grep -Eo '\b[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+)?(\+[0-9A-Za-z-]+)?\b' $COCOAPOD_SPEC | awk 'NR==1') | ||
|
||
echo "Detected Cocoapod Spec Version: ${cocoapod_spec_version}" | ||
|
||
# Checks branch name for a v followed by a semantic version MAJOR.MINOR.PATCH string | ||
release_version=$(git branch --show-current | sed -E 's/.*v([0-9]+\.[0-9]+\.[0-9]+).*/\1/') | ||
|
||
echo "Inferred Release Version: ${release_version}" | ||
|
||
if [ "${cocoapod_spec_version}" == "${release_version}" ]; then | ||
echo "Versions match" | ||
else | ||
echo "Versions do not match, please update ${COCOAPOD_SPEC} to ${release_version}" | ||
exit 1 | ||
fi |