Skip to content

Commit 9bcf43b

Browse files
committed
feat: add version validation
1 parent 251d82b commit 9bcf43b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/eas-build.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,30 @@ on:
5858
default: true
5959

6060
jobs:
61+
Validate:
62+
runs-on: ubuntu-latest
63+
permissions:
64+
contents: read
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v3
68+
with:
69+
fetch-depth: 0
70+
- name: Validate new version
71+
if: inputs.new-version
72+
run: |
73+
CURRENT_VERSION=$(node -p "require('./package.json').version")
74+
NEW_VERSION="${{ inputs.new-version }}"
75+
76+
echo "Current version: $CURRENT_VERSION"
77+
echo "New version: $NEW_VERSION"
78+
79+
npx semver -r ">=$CURRENT_VERSION" "$NEW_VERSION" > /dev/null
80+
81+
if [ $? -ne 0 ]; then
82+
echo "❌ New version must be greater than or equal to current version ($CURRENT_VERSION)"
83+
exit 1
84+
fi
6185
Build:
6286
runs-on: ${{ matrix.os }}
6387
permissions:

0 commit comments

Comments
 (0)