mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-07 15:10:01 +08:00
43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
name: Release Version Check
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'tools/goctl/v*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
version-check:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: '1.21'
|
|
|
|
- name: Extract tag version
|
|
id: get_version
|
|
run: |
|
|
# Extract version from tools/goctl/v* format
|
|
VERSION="${GITHUB_REF#refs/tags/tools/goctl/v}"
|
|
echo "VERSION=$VERSION" >> $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 '"')
|
|
echo "Version in code: $VERSION_IN_CODE"
|
|
echo "Expected version: $VERSION"
|
|
|
|
if [ "$VERSION_IN_CODE" != "$VERSION" ]; then
|
|
echo "Version mismatch: Version in code ($VERSION_IN_CODE) doesn't match tag version ($VERSION)"
|
|
exit 1
|
|
fi
|
|
echo "✅ Version check passed!"
|