From 8d1251f1287846daf42db4151b707d9f677be5a1 Mon Sep 17 00:00:00 2001 From: Larvan2 <78135608+Larvan2@users.noreply.github.com> Date: Fri, 9 Jun 2023 12:59:59 +0000 Subject: [PATCH] chore: generate release note automatically --- .github/genReleaseNote.sh | 6 +++--- .github/workflows/build.yml | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/genReleaseNote.sh b/.github/genReleaseNote.sh index 2c2afcc6..0425061d 100755 --- a/.github/genReleaseNote.sh +++ b/.github/genReleaseNote.sh @@ -18,15 +18,15 @@ if [ -z "$version_range" ]; then fi echo "## What's Changed" > release.md -git log --pretty=format:"* %s by @%an" --grep="^feat" $version_range | sort -f | uniq >> release.md +git log --pretty=format:"* %s by @%an" --grep="^feat" -i $version_range | sort -f | uniq >> release.md echo "" >> release.md echo "## BUG & Fix" >> release.md -git log --pretty=format:"* %s by @%an" --grep="^fix" $version_range | sort -f | uniq >> release.md +git log --pretty=format:"* %s by @%an" --grep="^fix" -i $version_range | sort -f | uniq >> release.md echo "" >> release.md echo "## Maintenance" >> release.md -git log --pretty=format:"* %s by @%an" --grep="^chore\|^docs" $version_range | sort -f | uniq >> release.md +git log --pretty=format:"* %s by @%an" --grep="^chore\|^docs\|^refactor" -i $version_range | sort -f | uniq >> release.md echo "" >> release.md echo "**Full Changelog**: https://github.com/MetaCubeX/Clash.Meta/compare/$version_range" >> release.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbf8e721..31a061b6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -94,11 +94,6 @@ jobs: run: echo "VERSION=alpha-$(git rev-parse --short HEAD)" >> $GITHUB_ENV shell: bash - - name: Set variables - if: ${{github.ref_name=='Beta'}} - run: echo "VERSION=beta-$(git rev-parse --short HEAD)" >> $GITHUB_ENV - shell: bash - - name: Set variables if: ${{github.ref_name=='Meta'}} run: echo "VERSION=meta-$(git rev-parse --short HEAD)" >> $GITHUB_ENV @@ -267,6 +262,23 @@ jobs: needs: [Build] runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Get tags + run: | + echo "CURRENTVERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + git fetch --tags + echo "PREVERSION=$(git describe --tags --abbrev=0 HEAD^)" >> $GITHUB_ENV + + - name: Generate release notes + run: | + cp ./.github/genReleaseNote.sh ./ + bash ./genReleaseNote.sh -v ${PREVERSION}...${CURRENTVERSION} + rm ./genReleaseNote.sh + - uses: actions/download-artifact@v3 with: name: artifact @@ -283,6 +295,7 @@ jobs: tag_name: ${{ github.ref_name }} files: bin/* generate_release_notes: true + body_path: release.md Docker: permissions: write-all