github.com/bytedance/mockey@v1.2.10/.github/workflows/release-check.yml (about) 1 name: Release Check 2 3 on: 4 pull_request: 5 branches: 6 - main 7 8 jobs: 9 build: 10 runs-on: ubuntu-latest 11 steps: 12 - uses: actions/checkout@v3 13 - name: Check Source Branch 14 run: python2 -c "exit(0 if '${{ github.head_ref }}'.startswith('release') or '${{ github.head_ref }}'.startswith('hotfix') else 1)" 15 - name: Check Version 16 run: | 17 # get version code, runner not support grep -E here 18 SOURCE_VERSION=`grep 'Version\s*=\s*\"v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\"' *.go | awk -F '\"' '{print $(NF-1)}'` 19 git checkout main 20 MASTER_VERSION=`grep 'Version\s*=\s*\"v[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\"' *.go | awk -F '\"' '{print $(NF-1)}'` 21 git checkout ${{Head.SHA}} 22 # check version update 23 python2 -c "exit(0 if list(map(int,'${SOURCE_VERSION#v}'.split('.')[:3])) > list(map(int,'${MASTER_VERSION#v}'.split('.')[:3])) else 1)"