|
| 1 | +#!/usr/bin/env bash |
| 2 | +set -euo pipefail |
| 3 | + |
| 4 | +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 5 | +DOCS_FILE="$SCRIPT_DIR/../SDK-VERSIONS.md" |
| 6 | + |
| 7 | +# Get current versions |
| 8 | +RN_VERSION=$("$SCRIPT_DIR/update-rn-version.sh" get-version) |
| 9 | +ANDROID_VERSION=$("$SCRIPT_DIR/update-android.sh" get-version) |
| 10 | +COCOA_VERSION=$("$SCRIPT_DIR/update-cocoa.sh" get-version) |
| 11 | +JS_VERSION=$("$SCRIPT_DIR/update-javascript.sh" get-version) |
| 12 | + |
| 13 | +echo "Current versions:" |
| 14 | +echo " React Native SDK: $RN_VERSION" |
| 15 | +echo " Android SDK: $ANDROID_VERSION" |
| 16 | +echo " Cocoa SDK: $COCOA_VERSION" |
| 17 | +echo " JavaScript SDK: $JS_VERSION" |
| 18 | + |
| 19 | +# Create the new row with GitHub release links for all SDKs |
| 20 | +RN_RELEASE_URL="https://github.com/getsentry/sentry-react-native/releases/tag/$RN_VERSION" |
| 21 | +ANDROID_RELEASE_URL="https://github.com/getsentry/sentry-java/releases/tag/$ANDROID_VERSION" |
| 22 | +COCOA_RELEASE_URL="https://github.com/getsentry/sentry-cocoa/releases/tag/$COCOA_VERSION" |
| 23 | +JS_RELEASE_URL="https://github.com/getsentry/sentry-javascript/releases/tag/$JS_VERSION" |
| 24 | +NEW_ROW="| [$RN_VERSION]($RN_RELEASE_URL) | [$ANDROID_VERSION]($ANDROID_RELEASE_URL) | [$COCOA_VERSION]($COCOA_RELEASE_URL) | [$JS_VERSION]($JS_RELEASE_URL) |" |
| 25 | + |
| 26 | +# Check if the docs file exists |
| 27 | +if [ ! -f "$DOCS_FILE" ]; then |
| 28 | + echo "Creating $DOCS_FILE..." |
| 29 | + cat > "$DOCS_FILE" << EOF |
| 30 | +# SDK Versions |
| 31 | +
|
| 32 | +This page lists which versions of the [Sentry Android SDK](https://github.com/getsentry/sentry-java), [Sentry Cocoa SDK](https://github.com/getsentry/sentry-cocoa), and [Sentry JavaScript SDK](https://github.com/getsentry/sentry-javascript) are bundled with each Sentry React Native SDK release. |
| 33 | +
|
| 34 | +## Maintenance |
| 35 | +
|
| 36 | +The SDK versions table is automatically updated during each release via the \`craft-pre-release.sh\` script. |
| 37 | +
|
| 38 | +To manually update the table with the current version, run \`./scripts/update-sdk-versions-table.sh\` from the repository root directory. |
| 39 | +
|
| 40 | +## Versions |
| 41 | +
|
| 42 | +| React Native SDK | Android SDK | Cocoa SDK | JavaScript SDK | |
| 43 | +| ---------------- | ----------- | --------- | -------------- | |
| 44 | +$NEW_ROW |
| 45 | +EOF |
| 46 | + echo "Created $DOCS_FILE with initial version entry" |
| 47 | +else |
| 48 | + # Check if this version already exists in the first column of the table |
| 49 | + if grep -qE "^\| \[$RN_VERSION\]\(" "$DOCS_FILE"; then |
| 50 | + echo "Version $RN_VERSION already exists in the table. Updating it..." |
| 51 | + # Remove the old version line (anchored to first column) and add the new one at the top |
| 52 | + grep -vE "^\| \[$RN_VERSION\]\(" "$DOCS_FILE" | \ |
| 53 | + awk -v new_row="$NEW_ROW" ' |
| 54 | + /^\| React Native SDK \|/ { |
| 55 | + print |
| 56 | + getline |
| 57 | + print |
| 58 | + print new_row |
| 59 | + next |
| 60 | + } |
| 61 | + { print } |
| 62 | + ' > "$DOCS_FILE.tmp" |
| 63 | + mv "$DOCS_FILE.tmp" "$DOCS_FILE" |
| 64 | + echo "Updated version $RN_VERSION in $DOCS_FILE" |
| 65 | + else |
| 66 | + echo "Adding new version to $DOCS_FILE..." |
| 67 | + # Find the header separator line and insert the new row after it |
| 68 | + awk -v new_row="$NEW_ROW" ' |
| 69 | + BEGIN { added = 0 } |
| 70 | + /^\| React Native SDK \|/ && added == 0 { |
| 71 | + print |
| 72 | + getline |
| 73 | + print |
| 74 | + print new_row |
| 75 | + added = 1 |
| 76 | + next |
| 77 | + } |
| 78 | + { print } |
| 79 | + ' "$DOCS_FILE" > "$DOCS_FILE.tmp" |
| 80 | + mv "$DOCS_FILE.tmp" "$DOCS_FILE" |
| 81 | + echo "Added version $RN_VERSION to $DOCS_FILE" |
| 82 | + fi |
| 83 | +fi |
| 84 | + |
| 85 | +echo "Done!" |
0 commit comments