mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
Updates `softprops/action-gh-release` from 1 to 2 - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v1...v2) Updates `peter-evans/create-pull-request` from 5 to 6 - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v5...v6) Updates `kentaro-m/auto-assign-action` from 1.2.5 to 2.0.0 - [Release notes](https://github.com/kentaro-m/auto-assign-action/releases) - [Commits](https://github.com/kentaro-m/auto-assign-action/compare/v1.2.5...v2.0.0) Updates `andymckay/cancel-action` from 0.3 to 0.5 - [Release notes](https://github.com/andymckay/cancel-action/releases) - [Commits](https://github.com/andymckay/cancel-action/compare/0.3...0.5) Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Constrat <56174894+Constrat@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
99 lines
3.3 KiB
YAML
99 lines
3.3 KiB
YAML
name: gen-changelog
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- ready_for_review
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
gen:
|
|
# startsWith 表达式不区分大小写
|
|
if: github.event.pull_request.draft == false && startsWith(github.event.pull_request.title, 'Release v')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
show-progress: false
|
|
|
|
- name: Extract tag name
|
|
id: extract_tag
|
|
env:
|
|
PR_BODY: ${{ format('{0}/{1}', runner.temp, 'output' ) }}
|
|
run: |
|
|
tag_name=$(echo "${{ github.event.pull_request.title }}" | sed -E 's/(Release|release)//' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
|
|
echo "tag_name=$tag_name" >> $GITHUB_OUTPUT
|
|
|
|
pr_title="docs: Auto Update Changelogs of "$tag_name
|
|
echo "pr_title=$pr_title" >> $GITHUB_OUTPUT
|
|
|
|
latest_stable_tag=$(git tag -l 'v*' | grep -v '-' | sort -V | tail -n 1) # 上一个 stable 版本
|
|
newest_tag=$(git describe --tags --match "v*" --abbrev=0) # 最新版本
|
|
echo "latest_stable_tag=$latest_stable_tag" >> $GITHUB_OUTPUT
|
|
echo "newest_tag=$newest_tag" >> $GITHUB_OUTPUT
|
|
|
|
if [[ $tag_name == *-* ]]; then # 判断新版本是否为 beta 版本
|
|
latest=$newest_tag # 若是,则将 latest 参数设置为最新版本
|
|
else
|
|
latest=$latest_stable_tag # 若否,则设置为上一个 stable 版本
|
|
fi
|
|
|
|
echo "latest=$latest" >> $GITHUB_OUTPUT
|
|
|
|
cat $GITHUB_OUTPUT
|
|
|
|
echo '======='
|
|
|
|
echo 'Target RP: ${{ github.event.pull_request.html_url }}' >> $PR_BODY
|
|
echo '' >> $PR_BODY
|
|
echo '<details><summary>Debug info</summary>' >> $PR_BODY
|
|
echo '' >> $PR_BODY
|
|
echo '```' >> $PR_BODY
|
|
sed 's/=/: /1' $GITHUB_OUTPUT >> $PR_BODY
|
|
echo '```' >> $PR_BODY
|
|
echo '' >> $PR_BODY
|
|
echo '</details>' >> $PR_BODY
|
|
|
|
cat $PR_BODY
|
|
|
|
- name: Generate Changelog
|
|
run: |
|
|
git switch dev
|
|
python3 tools/ChangelogGenerator/changelog_generator.py --tag "${{ steps.extract_tag.outputs.tag_name }}" --latest "${{ steps.extract_tag.outputs.latest }}"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Add files to git
|
|
run: |
|
|
git status
|
|
|
|
git config user.name "$GITHUB_ACTOR"
|
|
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
|
git add .
|
|
|
|
commit_msg="docs: Auto Generate Changelog of Release ""${{ steps.extract_tag.outputs.tag_name }}"
|
|
git commit -m "$commit_msg"
|
|
|
|
- name: Create PR
|
|
uses: peter-evans/create-pull-request@v6
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
title: ${{ steps.extract_tag.outputs.pr_title }}
|
|
body-path: ${{ format('{0}/{1}', runner.temp, 'output' ) }}
|
|
base: "dev"
|
|
branch: "changelog"
|
|
delete-branch: true
|
|
reviewers: |
|
|
AnnAngela
|
|
assignees: |
|
|
AnnAngela
|
|
|
|
- name: Add reviewers to release PR
|
|
uses: kentaro-m/auto-assign-action@v2.0.0
|
|
with:
|
|
configuration-path: ".github/release_reviewers.yaml"
|