From 6d839356a3660ada9f020ba72b8c702a97be30b5 Mon Sep 17 00:00:00 2001 From: liyp Date: Sat, 12 Apr 2025 21:14:39 +0800 Subject: [PATCH] =?UTF-8?q?Release=20v1.6.2=20=E6=B5=8B=E8=AF=95=E7=94=9F?= =?UTF-8?q?=E6=88=90readme.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/AutoRelease.yaml | 392 +++++++++++++++--------------- 1 file changed, 197 insertions(+), 195 deletions(-) diff --git a/.gitea/workflows/AutoRelease.yaml b/.gitea/workflows/AutoRelease.yaml index bcd3dc8..1d5c608 100644 --- a/.gitea/workflows/AutoRelease.yaml +++ b/.gitea/workflows/AutoRelease.yaml @@ -13,7 +13,6 @@ jobs: runs-on: ubuntu-latest # 以下是steps steps: - - name: 检出仓库 uses: https://git.linuxacme.com/iorebuild/checkout@v4 with: @@ -22,223 +21,226 @@ jobs: submodules: false - name: 设置环境变量 - id: RepoInfo - env: - CURRENT_USER_NAME: ${{ github.actor }} - CURRENT_USER_EMAIL: "" - CURRENT_REPO: ${{ github.repository }} - CURRENT_SERVER_URL: ${{ github.server_url }} + id: ActionEnv run: | - # 先读取邮箱再设置邮箱 - EMAIL=$(git log -1 --pretty=format:'%ae') - echo "CURRENT_USER_EMAIL=$EMAIL" >> $GITHUB_ENV - echo "用户名 = ${steps.RepoInfo.CURRENT_USER_NAME}}" - echo "邮箱 = $CURRENT_USER_EMAIL" - echo "仓库名 = $CURRENT_REPO" - echo "服务器URL = $CURRENT_SERVER_URL" + Name: ${{ github.actor }} + Email: $(git log -1 --pretty=format:'%ae') + Repo: ${{ github.repository }} + ServerUrl: ${{ github.server_url }} - - name: 设置环境变量 + echo "ENV_USER_NAME = $Name" >> $GITHUB_OUTPUT + echo "ENV_USER_EMAIL=$Email" >> $GITHUB_OUTPUT + echo "ENV_REPO_NAME = $Repo" >> $GITHUB_OUTPUT + echo "ENV_SERVER_UEL = $ServerUrl" >> $GITHUB_OUTPUT + + - name: 检查环境变量 run: | - git config user.name "$CURRENT_USER_NAME" - git config user.email "$CURRENT_USER_EMAIL" - echo "Name = $CURRENT_USER_NAME" - echo "Email = $CURRENT_USER_EMAIL" + echo "用户名 = ${{ steps.ActionEnv.outputs.ENV_USER_NAME }}" + echo "邮箱= ${{ steps.ActionEnv.outputs.ENV_USER_EMAIL }}" + echo "仓库名 = ${{ steps.ActionEnv.outputs.ENV_REPO_NAME }}" + echo "服务器URL = ${{ steps.ActionEnv.outputs.ENV_SERVER_UEL }}" - - name: 替换软件源为国内软件源(USTC) - run: | - cat /etc/os-release - sudo rm -f /etc/apt/sources.list - sudo rm -f /etc/apt/sources.list.d/* - sudo tee /etc/apt/sources.list <> $GITHUB_OUTPUT - echo "提取到的版本号: $VERSION" + # # git config user.name "$CURRENT_USER_NAME" + # # git config user.email "$CURRENT_USER_EMAIL" + # # echo "Name = $CURRENT_USER_NAME" + # # echo "Email = $CURRENT_USER_EMAIL" - - name: 验证版本号 - run: | - if [ -z "${{ steps.extract_version.outputs.version }}" ]; then - echo "::error::提交信息中未找到有效的版本号 (示例: 'Release v1.0.5')" - exit 1 - fi - echo "${{ steps.extract_version.outputs.version }}" + # - name: 替换软件源为国内软件源(USTC) + # run: | + # cat /etc/os-release + # sudo rm -f /etc/apt/sources.list + # sudo rm -f /etc/apt/sources.list.d/* + # sudo tee /etc/apt/sources.list <> $GITHUB_OUTPUT + # echo "提取到的版本号: $VERSION" - - name: 查找第1个.bin 文件 - id: find-bin-files-1 - run: | - BIN_FILES=$(find ./Bin -name "*.bin" -print0 | tr '\0' ',') - BIN_FILES=${BIN_FILES%,} - echo "bin_files=$BIN_FILES" >> $GITHUB_OUTPUT - echo "bin_files=$BIN_FILES" - - name: 查找第2个.bin 文件 - id: find-bin-files-2 - run: | - BIN_FILES=$(find ./Bin1 -name "*.bin" -print0 | tr '\0' ',') - BIN_FILES=${BIN_FILES%,} - echo "bin_files=$BIN_FILES" >> $GITHUB_OUTPUT - - name: 查找第3个.bin 文件 - id: find-bin-files-3 - run: | - BIN_FILES=$(find ./Bin2 -name "*.bin" -print0 | tr '\0' ',') - BIN_FILES=${BIN_FILES%,} - echo "bin_files=$BIN_FILES" >> $GITHUB_OUTPUT + # - name: 验证版本号 + # run: | + # if [ -z "${{ steps.extract_version.outputs.version }}" ]; then + # echo "::error::提交信息中未找到有效的版本号 (示例: 'Release v1.0.5')" + # exit 1 + # fi + # echo "${{ steps.extract_version.outputs.version }}" - - name: 获取上次发布标签 - id: get-previous-tag - run: | - PREVIOUS_TAG=$(git tag --sort=-creatordate | sed -n '2p') - if [ -z "$PREVIOUS_TAG" ]; then - PREVIOUS_TAG="HEAD~1" # 如果没有上次标签,使用上一次提交 - fi - echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT - echo "$PREVIOUS_TAG" + # - name: 创建并推送标签 + # run: | + # git tag -a ${{ steps.extract_version.outputs.version }} -m "Release ${{ steps.extract_version.outputs.version }}" + # git push origin ${{ steps.extract_version.outputs.version }} - - name: 获取提交记录 - id: get-commit-log - run: | - COMMIT_LOG=$(git log ${{ steps.get-previous-tag.outputs.previous_tag }}..HEAD --pretty=format:"- %s (%h)" | tr '\n' '\r') - echo "commit_log=$COMMIT_LOG" >> $GITHUB_OUTPUT - echo "commit_log=$COMMIT_LOG" + # - name: 查找第1个.bin 文件 + # id: find-bin-files-1 + # run: | + # BIN_FILES=$(find ./Bin -name "*.bin" -print0 | tr '\0' ',') + # BIN_FILES=${BIN_FILES%,} + # echo "bin_files=$BIN_FILES" >> $GITHUB_OUTPUT + # echo "bin_files=$BIN_FILES" + # - name: 查找第2个.bin 文件 + # id: find-bin-files-2 + # run: | + # BIN_FILES=$(find ./Bin1 -name "*.bin" -print0 | tr '\0' ',') + # BIN_FILES=${BIN_FILES%,} + # echo "bin_files=$BIN_FILES" >> $GITHUB_OUTPUT + # - name: 查找第3个.bin 文件 + # id: find-bin-files-3 + # run: | + # BIN_FILES=$(find ./Bin2 -name "*.bin" -print0 | tr '\0' ',') + # BIN_FILES=${BIN_FILES%,} + # echo "bin_files=$BIN_FILES" >> $GITHUB_OUTPUT - - name: 解析Release标题 - id: parse-release - run: | - commit_message="${{ github.event.head_commit.message }}" - title=$(echo "$commit_message" | cut -d ' ' -f 3-) - if [ -z "$title" ]; then - echo "未在提交信息中找到 Release 标题。" - title="default_title" - fi - # 使用新语法设置输出 - echo "title=$title" >> $GITHUB_OUTPUT - echo "title=$title" + # - name: 获取上次发布标签 + # id: get-previous-tag + # run: | + # PREVIOUS_TAG=$(git tag --sort=-creatordate | sed -n '2p') + # if [ -z "$PREVIOUS_TAG" ]; then + # PREVIOUS_TAG="HEAD~1" # 如果没有上次标签,使用上一次提交 + # fi + # echo "previous_tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT + # echo "$PREVIOUS_TAG" - - name: 获取最终Release信息 - run: | - echo "Version = ${{ steps.extract_version.outputs.version }}" - echo "Repo = ${{ github.server_url }}/${{ github.repository }}" - echo "TagName = ${{ steps.extract_version.outputs.version }}" - echo "ReleaseName = ${{ steps.parse-release.outputs.title }}" - echo "Body = ${{ steps.get-commit-log.outputs.commit_log }}" + # - name: 获取提交记录 + # id: get-commit-log + # run: | + # COMMIT_LOG=$(git log ${{ steps.get-previous-tag.outputs.previous_tag }}..HEAD --pretty=format:"- %s (%h)" | tr '\n' '\r') + # echo "commit_log=$COMMIT_LOG" >> $GITHUB_OUTPUT + # echo "commit_log=$COMMIT_LOG" - - name: 创建Gitea发布 - uses: https://git.linuxacme.com/iorebuild/gitea-release-action@main - with: - gitea_token: ${{ secrets.AUTOGENERATE }} - gitea_instance_url: ${{ github.server_url }} - repository: ${{ github.repository }} - name: ${{ steps.parse-release.outputs.title }} - tag_name: ${{ steps.extract_version.outputs.version }} - body: | - ${{ steps.get-commit-log.outputs.commit_log }} - draft: false - prerelease: false - files: | - ${{ steps.find-bin-files-1.outputs.bin_files }} - ${{ steps.find-bin-files-2.outputs.bin_files }} - ${{ steps.find-bin-files-3.outputs.bin_files }} + # - name: 解析Release标题 + # id: parse-release + # run: | + # commit_message="${{ github.event.head_commit.message }}" + # title=$(echo "$commit_message" | cut -d ' ' -f 3-) + # if [ -z "$title" ]; then + # echo "未在提交信息中找到 Release 标题。" + # title="default_title" + # fi + # # 使用新语法设置输出 + # echo "title=$title" >> $GITHUB_OUTPUT + # echo "title=$title" - AutoREADME.md: - # 工作在ubuntu-latest系统中 - runs-on: ubuntu-latest - # 以下是steps - steps: + # - name: 获取最终Release信息 + # run: | + # echo "Version = ${{ steps.extract_version.outputs.version }}" + # echo "Repo = ${{ github.server_url }}/${{ github.repository }}" + # echo "TagName = ${{ steps.extract_version.outputs.version }}" + # echo "ReleaseName = ${{ steps.parse-release.outputs.title }}" + # echo "Body = ${{ steps.get-commit-log.outputs.commit_log }}" - - name: 检出仓库 - uses: https://git.linuxacme.com/iorebuild/checkout@v4 - with: - fetch-depth: 0 - # 启用子模块支持 - submodules: false + # - name: 创建Gitea发布 + # uses: https://git.linuxacme.com/iorebuild/gitea-release-action@main + # with: + # gitea_token: ${{ secrets.AUTOGENERATE }} + # gitea_instance_url: ${{ github.server_url }} + # repository: ${{ github.repository }} + # name: ${{ steps.parse-release.outputs.title }} + # tag_name: ${{ steps.extract_version.outputs.version }} + # body: | + # ${{ steps.get-commit-log.outputs.commit_log }} + # draft: false + # prerelease: false + # files: | + # ${{ steps.find-bin-files-1.outputs.bin_files }} + # ${{ steps.find-bin-files-2.outputs.bin_files }} + # ${{ steps.find-bin-files-3.outputs.bin_files }} - - name: 设置环境变量 - run: | - git config user.name "$CURRENT_USER_NAME" - git config user.email "$CURRENT_USER_EMAIL" - echo "Name = $CURRENT_USER_NAME" - echo "Email = $CURRENT_USER_EMAIL" + # AutoREADME.md: + # # 工作在ubuntu-latest系统中 + # runs-on: ubuntu-latest + # # 以下是steps + # steps: - - name: 替换软件源为国内软件源(USTC) - run: | - cat /etc/os-release - sudo rm -f /etc/apt/sources.list - sudo rm -f /etc/apt/sources.list.d/* - sudo tee /etc/apt/sources.list < README.md - echo "$TEMP" >> README.md - else - echo "$REPO_NAME" > README.md - fi + # - name: 替换软件源为国内软件源(USTC) + # run: | + # cat /etc/os-release + # sudo rm -f /etc/apt/sources.list + # sudo rm -f /etc/apt/sources.list.d/* + # sudo tee /etc/apt/sources.list < README.md + # echo "$TEMP" >> README.md + # else + # echo "$REPO_NAME" > README.md + # fi + + # - name: Fetch Gitea Releases + # id: fetch-releases + # run: | + # # 使用 Gitea API 获取所有 Release 信息 + # releases=$(curl -s -H "Authorization: token $GITEA_TOKEN" "$GITEA_API_URL/repos/$GITEA_OWNER/$GITEA_REPO/releases") - # 将 JSON 数据解析为数组 - releases_array=$(echo "$releases" | jq -c '.[]') + # # 将 JSON 数据解析为数组 + # releases_array=$(echo "$releases" | jq -c '.[]') - # 按发布时间排序 - sorted_releases=$(echo "$releases_array" | jq -s 'sort_by(.published_at)') + # # 按发布时间排序 + # sorted_releases=$(echo "$releases_array" | jq -s 'sort_by(.published_at)') - # 生成 Markdown 内容 - markdown_content="# Releases\n\n" - while read -r release; do - tag_name=$(echo "$release" | jq -r '.tag_name') - published_at=$(echo "$release" | jq -r '.published_at') - body=$(echo "$release" | jq -r '.body') + # # 生成 Markdown 内容 + # markdown_content="# Releases\n\n" + # while read -r release; do + # tag_name=$(echo "$release" | jq -r '.tag_name') + # published_at=$(echo "$release" | jq -r '.published_at') + # body=$(echo "$release" | jq -r '.body') - markdown_content+=$(printf "## %s (%s)\n\n%s\n\n" "$tag_name" "$published_at" "$body") - done <<< "$sorted_releases" + # markdown_content+=$(printf "## %s (%s)\n\n%s\n\n" "$tag_name" "$published_at" "$body") + # done <<< "$sorted_releases" - # 将内容写入 README.md - echo "$markdown_content" > README.md + # # 将内容写入 README.md + # echo "$markdown_content" > README.md - - name: 提交和推送代码 - run: | - git add README.md - git commit -m "Update README.md" - git push https://${{ secrets.AUTOGENERATE }}@git.linuxacme.com/${{ github.repository }} + # - name: 提交和推送代码 + # run: | + # git add README.md + # git commit -m "Update README.md" + # git push https://${{ secrets.AUTOGENERATE }}@git.linuxacme.com/${{ github.repository }}