Skip to content

Check Oniguruma Version #8

Check Oniguruma Version

Check Oniguruma Version #8

name: Check Oniguruma Version
on:
schedule:
- cron: '0 0 * * MON'
workflow_dispatch:
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Check versions
id: version-check
run: |
# Get version from oniguruma.h
ONIG_VERSION_INT=$(grep "ONIGURUMA_VERSION_INT" "oniguruma/src/oniguruma.h" | awk '{print $3}')
ONIG_MAJOR=$((ONIG_VERSION_INT/10000))
ONIG_MINOR=$(((ONIG_VERSION_INT/100)%100))
ONIG_TEENY=$((ONIG_VERSION_INT%100))
ONIG_VERSION="$ONIG_MAJOR.$ONIG_MINOR.$ONIG_TEENY"
# Get versions from iOS plists
IOS_SIM_VERSION=$(grep -A1 'OnigurumaVersion' "ios/Oniguruma.xcframework/ios-arm64_x86_64-simulator/Resources/Info.plist" | tail -n1 | sed -n 's:.*<string>\(.*\)</string>.*:\1:p')
IOS_DEVICE_VERSION=$(grep -A1 'OnigurumaVersion' "ios/Oniguruma.xcframework/ios-arm64/Resources/Info.plist" | tail -n1 | sed -n 's:.*<string>\(.*\)</string>.*:\1:p')
# Get version from Android properties
if [ -f "android/src/main/resources/oniguruma-version.properties" ]; then
ANDROID_VERSION=$(grep "^version=" "android/src/main/resources/oniguruma-version.properties" | cut -d'=' -f2)
else
ANDROID_VERSION="not found"
fi
if [ "$ONIG_VERSION" != "$IOS_SIM_VERSION" ] || [ "$ONIG_VERSION" != "$IOS_DEVICE_VERSION" ] || [ "$ONIG_VERSION" != "$ANDROID_VERSION" ]; then
echo "::set-output name=needs_update::true"
echo "::set-output name=onig_version::$ONIG_VERSION"
echo "::set-output name=ios_sim_version::$IOS_SIM_VERSION"
echo "::set-output name=ios_device_version::$IOS_DEVICE_VERSION"
echo "::set-output name=android_version::$ANDROID_VERSION"
fi
- name: Handle Issue
if: steps.version-check.outputs.needs_update == 'true'
uses: actions/github-script@v7
with:
script: |
const onigVersion = '${{ steps.version-check.outputs.onig_version }}';
const iosSimVersion = '${{ steps.version-check.outputs.ios_sim_version }}';
const iosDeviceVersion = '${{ steps.version-check.outputs.ios_device_version }}';
const androidVersion = '${{ steps.version-check.outputs.android_version }}';
const issues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
labels: ['oniguruma-version']
});
const body = `The Oniguruma versions are out of sync:
- Submodule version: ${onigVersion}
- iOS Simulator framework version: ${iosSimVersion}
- iOS Device framework version: ${iosDeviceVersion}
- Android library version: ${androidVersion}
Please rebuild the native libraries with the latest version.
Last checked: ${new Date().toISOString()}`;
if (issues.data.length === 0) {
// Create new issue
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: '🔄 Oniguruma Version Mismatch Detected',
labels: ['oniguruma-version'],
body: body
});
} else {
// Update existing issue
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issues.data[0].number,
body: body
});
}