From d1f7c73c5057ba1d2e55fd10b5b80d92774ef551 Mon Sep 17 00:00:00 2001 From: jmal Date: Fri, 17 May 2024 17:25:19 +0800 Subject: [PATCH] chore: update release --- .github/release-drafter.yml | 21 +++++++ .github/workflows/release-drafter.yml | 20 +++++++ .github/workflows/release.yml | 79 --------------------------- 3 files changed, 41 insertions(+), 79 deletions(-) create mode 100644 .github/release-drafter.yml create mode 100644 .github/workflows/release-drafter.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 00000000..649f58c5 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,21 @@ +# .github/release-drafter.yml +name-template: 'v$NEXT_PATCH_VERSION 🌟' +tag-template: 'v$NEXT_PATCH_VERSION' +categories: + - title: '新功能 ✨' + labels: + - 'feat' + - title: '修复 🐛' + labels: + - 'fix' + - title: '优化 🎨' + labels: + - 'perf' +change-template: '- $TITLE (#$NUMBER) @${{PRAUTHOR}}' +no-changes-template: '- No changes' +replacers: + - search: '(.*)' + replace: 'Updated: $1' +template: | + ## Changes + $CHANGES diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 00000000..ab2860a6 --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -0,0 +1,20 @@ +# .github/workflows/release-drafter.yml +name: Release Drafter + +on: + push: + branches: + - release + pull_request: + types: [closed] + +jobs: + update_release_draft: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: release-drafter/release-drafter@v5 + with: + config-name: release-drafter.yml + env: + GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index fbb588ad..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Create Release with Jar - -on: - push: - branches: - - release - -jobs: - build-and-release: - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up JDK 17 - uses: actions/setup-java@v2 - with: - distribution: 'temurin' - java-version: '17' - - - name: Build with Maven - run: mvn clean package -DskipTests - - - name: Extract project version from pom.xml - run: | - VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) - echo "PROJECT_VERSION=$VERSION" >> $GITHUB_ENV - - - name: Generate Release Notes - id: generate_release_notes - run: | - git fetch --prune --unshallow - LATEST_TAG=$(git describe --tags --abbrev=0) - FEAT_MSGS=$(git log $LATEST_TAG..HEAD --grep 'feat:' --pretty=format:"- %s%n" | sed 's/feat://') - FIX_MSGS=$(git log $LATEST_TAG..HEAD --grep 'fix:' --pretty=format:"- %s%n" | sed 's/fix://') - PERF_MSGS=$(git log $LATEST_TAG..HEAD --grep 'perf:' --pretty=format:"- %s%n" | sed 's/perf://') - RELEASE_NOTES="" - if [ -n "$FEAT_MSGS" ]; then - RELEASE_NOTES+="### 新功能 ✨\n${FEAT_MSGS}\n" - fi - if [ -n "$FIX_MSGS" ]; then - RELEASE_NOTES+="### 修复 🐛\n${FIX_MSGS}\n" - fi - if [ -n "$PERF_MSGS" ]; then - RELEASE_NOTES+="### 优化 🎨\n${PERF_MSGS}\n" - fi - echo -e "RELEASE_NOTES<> $GITHUB_ENV - - - name: Create Git tag - run: | - git config user.name "GitHub Actions" - git config user.email "github-actions@users.noreply.github.com" - git tag -a v${{ env.PROJECT_VERSION }} -m "v${{ env.PROJECT_VERSION }}" - git push origin v${{ env.PROJECT_VERSION }} - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} - with: - tag_name: v${{ env.PROJECT_VERSION }} - release_name: v${{ env.PROJECT_VERSION }} - body: | - ## Changes in this release: - ${{ env.RELEASE_NOTES }} - draft: false - prerelease: false - - - name: Upload Jar to Release - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./target/clouddisk-${{ env.PROJECT_VERSION }}.jar - asset_name: clouddisk-${{ env.PROJECT_VERSION }}.jar - asset_content_type: application/java-archive