Skip to content

Commit 9bfccfb

Browse files
authored
Merge pull request #593 from timrogers/timrogers/github-version
Validate in CI that the GitHub server versions in `package.json` and `version.ts` match
2 parents 710db07 + 01ec2b7 commit 9bfccfb

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

.github/workflows/version-check.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Version Consistency Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
github:
13+
name: Check GitHub server version consistency
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Check version consistency
19+
run: |
20+
PACKAGE_VERSION=$(node -p "require('./src/github/package.json').version")
21+
TS_VERSION=$(grep -o '".*"' ./src/github/common/version.ts | tr -d '"')
22+
23+
if [ "$PACKAGE_VERSION" != "$TS_VERSION" ]; then
24+
echo "::error::Version mismatch detected!"
25+
echo "::error::package.json version: $PACKAGE_VERSION"
26+
echo "::error::version.ts version: $TS_VERSION"
27+
exit 1
28+
else
29+
echo "✅ Versions match: $PACKAGE_VERSION"
30+
fi

src/github/common/version.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
// If the format of this file changes, so it doesn't simply export a VERSION constant,
2+
// this will break .github/workflows/version-check.yml.
13
export const VERSION = "0.6.2";

0 commit comments

Comments
 (0)