mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-13 09:50:00 +08:00
Create version-check.yml (#4646)
This commit is contained in:
37
.github/workflows/version-check.yml
vendored
Normal file
37
.github/workflows/version-check.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
name: Release Version Check
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'tools/goctl/v*'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
version-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version: '1.21'
|
||||||
|
|
||||||
|
- name: Extract tag version
|
||||||
|
id: get_version
|
||||||
|
run: |
|
||||||
|
# Extract version from tools/goctl/v* format
|
||||||
|
echo "VERSION=${GITHUB_REF#refs/tags/tools/goctl/v}" >> $GITHUB_ENV
|
||||||
|
echo "Extracted version: $VERSION"
|
||||||
|
|
||||||
|
- name: Check version in goctl source code
|
||||||
|
run: |
|
||||||
|
# Change to goctl directory
|
||||||
|
cd tools/goctl
|
||||||
|
|
||||||
|
# Check version in BuildVersion constant
|
||||||
|
VERSION_IN_CODE=$(grep -r "const BuildVersion =" . | grep -o '".*"' | tr -d '"')
|
||||||
|
if [ "$VERSION_IN_CODE" != "$VERSION" ]; then
|
||||||
|
echo "Version mismatch: Version in code ($VERSION_IN_CODE) doesn't match tag version ($VERSION)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user