From d5f719c1a26c22cd59a6b0cc7a36de0cd4059620 Mon Sep 17 00:00:00 2001 From: Tim Rogers Date: Tue, 4 Feb 2025 12:21:49 +0000 Subject: [PATCH] Validate in CI that the GitHub server versions in `package.json` and `version.ts` match --- .github/workflows/version-check.yml | 29 +++++++++++++++++++++++++++++ src/github/common/version.ts | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 .github/workflows/version-check.yml diff --git a/.github/workflows/version-check.yml b/.github/workflows/version-check.yml new file mode 100644 index 00000000..35b2f175 --- /dev/null +++ b/.github/workflows/version-check.yml @@ -0,0 +1,29 @@ +name: Version Consistency Check + +on: + push: + branches: + - main + paths: + - "src/github/**" + +jobs: + github: + name: Check GitHub server version consistency + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Check version consistency + run: | + PACKAGE_VERSION=$(node -p "require('./src/github/package.json').version") + TS_VERSION=$(grep -o '".*"' ./src/github/common/version.ts | tr -d '"') + + if [ "$PACKAGE_VERSION" != "$TS_VERSION" ]; then + echo "::error::Version mismatch detected!" + echo "::error::package.json version: $PACKAGE_VERSION" + echo "::error::version.ts version: $TS_VERSION" + exit 1 + else + echo "✅ Versions match: $PACKAGE_VERSION" + fi diff --git a/src/github/common/version.ts b/src/github/common/version.ts index 00b8a691..648f7c6b 100644 --- a/src/github/common/version.ts +++ b/src/github/common/version.ts @@ -1 +1,3 @@ +// If the format of this file changes, so it doesn't simply export a VERSION constant, +// this will break .github/workflows/version-check.yml. export const VERSION = "0.6.2"; \ No newline at end of file