forked from constanline/XQuickEnergy
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
khaos
committed
Dec 7, 2024
1 parent
e50ae75
commit 0583700
Showing
1 changed file
with
14 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,27 @@ | ||
name: Get Latest Release Tag | ||
name: Get Latest Release and Branch Tag | ||
|
||
on: | ||
workflow_dispatch: # 手动触发工作流 | ||
|
||
jobs: | ||
get_latest_release: | ||
get_latest_tags: | ||
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: | | ||
# 获取 myLazyNoSo 分支的所有标签,按时间倒序排列 | ||
git fetch --tags # 确保获取所有标签 | ||
TAGS=$(git for-each-ref --sort=-creatordate --format '%(refname:short)' refs/tags | grep -E '^v' | head -n 1) | ||
echo "myLazyNoSo 分支的最新标签: ${TAGS}" |