added version check + fixed release
This commit is contained in:
35
.gitea/workflows/version-check.yaml
Normal file
35
.gitea/workflows/version-check.yaml
Normal file
@@ -0,0 +1,35 @@
|
||||
name: Version Check
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'Cargo.toml'
|
||||
|
||||
jobs:
|
||||
check-version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Compare versions
|
||||
shell: bash
|
||||
run: |
|
||||
NEW_VERSION=$(grep -m 1 '^version =' Cargo.toml | cut -d '"' -f 2)
|
||||
|
||||
git fetch origin ${{ github.base_ref }}
|
||||
OLD_VERSION=$(git show origin/${{ github.base_ref }}:Cargo.toml | grep -m 1 '^version =' | cut -d '"' -f 2)
|
||||
|
||||
echo "Old version (main): $OLD_VERSION"
|
||||
echo "New version (PR): $NEW_VERSION"
|
||||
|
||||
if [ "$NEW_VERSION" = "$OLD_VERSION" ]; then
|
||||
echo "Error: Cargo.toml version has not been updated in this PR!"
|
||||
exit 1
|
||||
else
|
||||
echo "Success: Version updated from $OLD_VERSION to $NEW_VERSION"
|
||||
fi
|
||||
Reference in New Issue
Block a user