Skip to content

Build and Release

Build and Release #15

name: Check and Notify Version
on:
workflow_dispatch: # 手动触发工作流
jobs:
check_version:
runs-on: ubuntu-latest
steps:
- name: 检出代码
uses: actions/checkout@v3
with:
fetch-depth: 0 # 拉取所有标签和完整历史
- name: 获取最新发布版本标签
run: |
RESPONSE=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest")
RELEASE_TAG=$(echo "${RESPONSE}" | jq -r .tag_name)
echo "最新发布的版本标签: ${RELEASE_TAG}"
- name: 获取 myLazyNoSo 分支的最新标签
run: |
git fetch --tags # 确保获取所有标签
TAGS=$(git for-each-ref --sort=-creatordate --format '%(refname:short)' refs/tags | grep -E '^v' | head -n 1)
echo "myLazyNoSo 分支的最新标签: ${TAGS}"
- name: 比较版本标签
run: |
if [ "$RELEASE_TAG" == "$TAGS" ]; then
echo "版本相同: 发布版本标签和 myLazyNoSo 分支标签相同,无需发版"
else
echo "版本不同: 发布版本标签和 myLazyNoSo 分支标签不同,需要发版"
fi