Skip to content

Commit

Permalink
ci: add pod spec version check on release branch pushes (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjl-mux authored Aug 1, 2023
1 parent 01d10c4 commit 5c6a5c5
Show file tree
Hide file tree
Showing 2 changed files with 37 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

20 changes: 20 additions & 0 deletions scripts/version-check.sh
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

0 comments on commit 5c6a5c5

Please sign in to comment.