From 21df7baea4e6471d3e7e0786ee80cedec5046113 Mon Sep 17 00:00:00 2001 From: Anyon Date: Wed, 7 Aug 2024 23:02:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=8C=85=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tags_and_releases.py => clear-releases.py} | 0 bin/clearTag.cmd => .github/clear-tags.cmd | 0 {bin => .github}/release.sh | 0 {bin => .github}/split-linux.sh | 2 +- {bin => .github}/splitsh-lite-linux | Bin .github/workflows/clear.yml | 2 +- .github/workflows/release.yml | 154 +++++++++--------- .github/workflows/split.yml | 2 +- 8 files changed, 80 insertions(+), 80 deletions(-) rename .github/{delete_tags_and_releases.py => clear-releases.py} (100%) rename bin/clearTag.cmd => .github/clear-tags.cmd (100%) rename {bin => .github}/release.sh (100%) mode change 100755 => 100644 rename {bin => .github}/split-linux.sh (90%) mode change 100755 => 100644 rename {bin => .github}/splitsh-lite-linux (100%) mode change 100755 => 100644 diff --git a/.github/delete_tags_and_releases.py b/.github/clear-releases.py similarity index 100% rename from .github/delete_tags_and_releases.py rename to .github/clear-releases.py diff --git a/bin/clearTag.cmd b/.github/clear-tags.cmd similarity index 100% rename from bin/clearTag.cmd rename to .github/clear-tags.cmd diff --git a/bin/release.sh b/.github/release.sh old mode 100755 new mode 100644 similarity index 100% rename from bin/release.sh rename to .github/release.sh diff --git a/bin/split-linux.sh b/.github/split-linux.sh old mode 100755 new mode 100644 similarity index 90% rename from bin/split-linux.sh rename to .github/split-linux.sh index 8b029a92f..fa41a66de --- a/bin/split-linux.sh +++ b/.github/split-linux.sh @@ -6,7 +6,7 @@ BASEPATH=$(cd `dirname $0`; cd ../plugin/; pwd) REPOS=$@ function split() { - SHA1=`./bin/splitsh-lite-linux --prefix=$1` + SHA1=`.github/splitsh-lite-linux --prefix=$1` git push $2 "$SHA1:refs/heads/$CURRENT_BRANCH" -f } diff --git a/bin/splitsh-lite-linux b/.github/splitsh-lite-linux old mode 100755 new mode 100644 similarity index 100% rename from bin/splitsh-lite-linux rename to .github/splitsh-lite-linux diff --git a/.github/workflows/clear.yml b/.github/workflows/clear.yml index 7fec2bd32..3e035040a 100644 --- a/.github/workflows/clear.yml +++ b/.github/workflows/clear.yml @@ -22,4 +22,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.TOKEN }} run: | - python .github/delete_tags_and_releases.py \ No newline at end of file + python .github/clear-releases.py \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9811a8f35..422f0e81a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,78 +1,78 @@ -####### 可解析的提交前缀 ######## -# ci: 持续集成 -# fix: 修改 -# feat: 新增 -# refactor: 重构 -# docs: 文档 -# style: 样式 -# chore: 其他 -# build: 构建 -# pref: 优化 -# test: 测试 -############################### - -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -name: Create Release -permissions: write-all - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: 18 - - - name: Install dependencies - run: npm install -g gen-git-log - - - name: Find Last Tag - id: last_tag - run: | - - # 获取所有标签,按版本排序(降序) - Tags=$(git tag --list --sort=-version:refname) - - # 获取最新的标签(即列表中的第一个) - LATEST_TAG=$(echo "$Tags" | awk 'NR==1 {print $1; exit}') - - # 获取倒数第二个标签(如果存在) - if [[ -n "$Tags" ]]; then - # 使用 tail 获取除了最后一个标签之外的所有标签,然后用 head 获取第一个 - SECOND_LATEST_TAG=$(echo "$Tags" | tail -n +2 | head -n 1) - else - SECOND_LATEST_TAG="" - fi - - # 设置输出变量 - echo "::set-output name=tag_last::${LATEST_TAG:-v1.0.0}" - echo "::set-output name=tag_second::${SECOND_LATEST_TAG:-v1.0.0}" - - - name: Generate Release Notes - run: | - rm -rf log - newTag=${{ steps.last_tag.outputs.tag_last }} - git-log -m tag -f -S ${{ steps.last_tag.outputs.tag_second }} -v ${newTag#v} - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.last_tag.outputs.tag_last }} - release_name: Release ${{ steps.last_tag.outputs.tag_last }} - body_path: log/${{steps.last_tag.outputs.tag_last}}.md - draft: false +####### 可解析的提交前缀 ######## +# ci: 持续集成 +# fix: 修改 +# feat: 新增 +# refactor: 重构 +# docs: 文档 +# style: 样式 +# chore: 其他 +# build: 构建 +# pref: 优化 +# test: 测试 +############################### + +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Create Release +permissions: write-all + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 18 + + - name: Install dependencies + run: npm install -g gen-git-log + + - name: Find Last Tag + id: last_tag + run: | + + # 获取所有标签,按版本排序(降序) + Tags=$(git tag --list --sort=-version:refname) + + # 获取最新的标签(即列表中的第一个) + LATEST_TAG=$(echo "$Tags" | awk 'NR==1 {print $1; exit}') + + # 获取倒数第二个标签(如果存在) + if [[ -n "$Tags" ]]; then + # 使用 tail 获取除了最后一个标签之外的所有标签,然后用 head 获取第一个 + SECOND_LATEST_TAG=$(echo "$Tags" | tail -n +2 | head -n 1) + else + SECOND_LATEST_TAG="" + fi + + # 设置输出变量 + echo "::set-output name=tag_last::${LATEST_TAG:-v1.0.0}" + echo "::set-output name=tag_second::${SECOND_LATEST_TAG:-v1.0.0}" + + - name: Generate Release Notes + run: | + rm -rf log + newTag=${{ steps.last_tag.outputs.tag_last }} + git-log -m tag -f -S ${{ steps.last_tag.outputs.tag_second }} -v ${newTag#v} + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.last_tag.outputs.tag_last }} + release_name: Release ${{ steps.last_tag.outputs.tag_last }} + body_path: log/${{steps.last_tag.outputs.tag_last}}.md + draft: false prerelease: false \ No newline at end of file diff --git a/.github/workflows/split.yml b/.github/workflows/split.yml index 4431a9e12..4729b8a34 100644 --- a/.github/workflows/split.yml +++ b/.github/workflows/split.yml @@ -24,4 +24,4 @@ jobs: git config pull.rebase true git config --global user.name "Anyon" git config --global user.email "zoujingli@qq.com" - ./bin/split-linux.sh + ./.github/split-linux.sh