Release v1.6.8 测试生成readme.md
Some checks failed
自动版本发布 / AutoRelease (push) Successful in 16s
自动版本发布 / AutoREADME.md (push) Failing after 8s

This commit is contained in:
iorebuild 2025-04-12 22:03:31 +08:00
parent fb1d348cf6
commit ab3fc14c13

View File

@ -24,6 +24,7 @@ jobs:
id: ActionEnv
run: |
# 正确的变量赋值
UserToken="${{ secrets.AUTOGENERATE }}"
UserName="${{ github.actor }}"
UserEmail=$(git log -1 --pretty=format:'%ae')
GitRepo="${{ github.repository }}"
@ -31,6 +32,7 @@ jobs:
RepoUrl="${{ github.repository }}"
# 将变量设置为步骤输出
echo "ENV_USER_TOKEN=$ServerUrl/$UserToken" >> $GITHUB_OUTPUT
echo "ENV_USER_NAME=$UserName" >> $GITHUB_OUTPUT
echo "ENV_USER_EMAIL=$UserEmail" >> $GITHUB_OUTPUT
echo "ENV_REPO_NAME=$GitRepo" >> $GITHUB_OUTPUT
@ -149,7 +151,7 @@ jobs:
- name: 创建Gitea发布
uses: https://git.linuxacme.com/iorebuild/gitea-release-action@main
with:
gitea_token: ${{ secrets.AUTOGENERATE }}
gitea_token: ${{ steps.ActionEnv.outputs.ENV_USER_TOKEN }}
gitea_instance_url: ${{ steps.ActionEnv.outputs.ENV_SERVER_URL }}
repository: ${{ steps.ActionEnv.outputs.ENV_REPO_NAME }}
name: ${{ steps.parse-release.outputs.title }}
@ -180,6 +182,7 @@ jobs:
id: ActionEnv
run: |
# 正确的变量赋值
UserToken="${{ secrets.AUTOGENERATE }}"
UserName="${{ github.actor }}"
UserEmail=$(git log -1 --pretty=format:'%ae')
GitRepo="${{ github.repository }}"
@ -187,6 +190,7 @@ jobs:
RepoUrl="${{ github.repository }}"
# 将变量设置为步骤输出
echo "ENV_USER_TOKEN=$ServerUrl/$UserToken" >> $GITHUB_OUTPUT
echo "ENV_USER_NAME=$UserName" >> $GITHUB_OUTPUT
echo "ENV_USER_EMAIL=$UserEmail" >> $GITHUB_OUTPUT
echo "ENV_REPO_NAME=$GitRepo" >> $GITHUB_OUTPUT
@ -231,44 +235,44 @@ jobs:
echo "README.md does not exist."
fi
# - name: 添加工程名字到README.md
# run: |
# REPO_NAME="ActionDemo"
# if [ -f "README.md" ]; then
# TEMP=$(cat README.md)
# echo "$REPO_NAME" > README.md
# echo "$TEMP" >> README.md
# else
# echo "$REPO_NAME" > README.md
# fi
- name: 添加工程名字到README.md
run: |
REPO_NAME="ActionDemo"
if [ -f "README.md" ]; then
TEMP=$(cat README.md)
echo "$REPO_NAME" > 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")
- name: Fetch Gitea Releases
id: fetch-releases
run: |
# 使用 Gitea API 获取所有 Release 信息
releases=$(curl -s -H "Authorization: token ${{ steps.ActionEnv.outputs.ENV_USER_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 }}