Skip to content

Commit

Permalink
ci: add version check on release branches
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjl-mux committed Aug 1, 2023
1 parent 4b1fe41 commit a1211f7
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/validate-release.yml
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

21 changes: 21 additions & 0 deletions scripts/version-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

readonly COCOAPOD_SPEC=Mux-Upload-SDK.podspec

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}"

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 the cocoapod spec to ${release_version}"
exit 1
fi



0 comments on commit a1211f7

Please sign in to comment.