diff --git a/.gitea/workflows/AutoGenerateREADME.yaml b/.gitea/workflows/AutoGenerateREADME.yaml index 6a2661a..b09122c 100644 --- a/.gitea/workflows/AutoGenerateREADME.yaml +++ b/.gitea/workflows/AutoGenerateREADME.yaml @@ -1,4 +1,4 @@ -name: 自动生成README.md文件 +name: 自动版本发布 on: push: @@ -9,7 +9,7 @@ jobs: create-readme: runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, 'AutoGenerateREADME.md')" + if: "!contains(github.event.head_commit.message, 'AutoRelease.md')" steps: - name: 删除本地仓库副本 @@ -29,35 +29,16 @@ jobs: CLEAN_REPO_URL="${CLEAN_REPO_URL#https://}" git clone "https://${GITEA_TOKEN}@${CLEAN_REPO_URL}" . - - name: 创建README.md + - name: 生成版本号 + id: version run: | - if [ -f README.md ]; then - rm README.md - fi + VERSION=$(date +'%Y%m%d%H%M%S') + echo "version=$VERSION" >> $GITHUB_OUTPUT - - name: 生成提交历史记录 - id: commit-history + - name: 创建 Release run: | - COMMIT_HISTORY=$(git log --pretty=format:"- %cd %h %an: %s" --date=short) - echo "::set-output name=commit_history::$COMMIT_HISTORY" - - - name: 生成Release历史记录 - id: release-history - run: | - RELEASE_HISTORY=$(gh release list --limit 100 --json tagName,publishedAt,body --template '{{range .}}- {{.publishedAt}} {{.tagName}}: {{.body}}{{"\n"}}{{end}}') - echo "::set-output name=release_history::$RELEASE_HISTORY" - - - name: 将提交和Release记录添加到README.md - run: | - { - echo - echo "# 提交历史记录" - echo "${{ steps.commit-history.outputs.commit_history }}" - echo - echo "# Release历史记录" - echo "${{ steps.release-history.outputs.release_history }}" - } >> README.md - + gh release create v${{ steps.version.outputs.version }} --generate-notes + - name: 重新提交仓库 env: GITEA_TOKEN: ${{ secrets.AUTOGENERATE }} @@ -71,6 +52,6 @@ jobs: if git diff --staged --quiet; then echo "No changes to commit." else - git commit -m "AutoGenerateREADME.md" + git commit -m "AutoRelease.md" git push "https://${GITEA_TOKEN}@${CLEAN_REPO_URL}" fi \ No newline at end of file