From 2e82f831ffa4c3b3ec44395f0aaed78c14d3e9a2 Mon Sep 17 00:00:00 2001 From: ForteScarlet Date: Fri, 26 Jan 2024 02:42:28 +0800 Subject: [PATCH] CI config --- .github/workflows/publish-release.yml | 24 +++++++++++++++++++++--- build.gradle.kts | 13 +++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 196064c..9e40575 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -21,7 +21,7 @@ env: jobs: test-build-publish: name: Test and build -# runs-on: ubuntu-latest + # runs-on: ubuntu-latest strategy: matrix: os: [ macos-latest, windows-latest, ubuntu-latest ] @@ -96,10 +96,28 @@ jobs: create-release: name: Create release runs-on: ubuntu-latest - needs: [test-build-publish, publish-gradle-plugin] + needs: [ test-build-publish, publish-gradle-plugin ] permissions: contents: write steps: + # 检出仓库代码 + - name: Check out repo + uses: actions/checkout@v3 + + # Setup java + # https://github.com/marketplace/actions/setup-java-jdk + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: 11 + + - name: Create changelog + uses: gradle/gradle-build-action@v2 + with: + gradle-version: 8.5 + arguments: createChangelog + # https://github.com/softprops/action-gh-release # Create gitHub release - name: Create Github Release @@ -107,6 +125,6 @@ jobs: with: token: ${{ secrets.FORTE_TOKEN }} draft: true -# body_path: .changelog/${{ github.ref_name }}.md + body_path: .changelog/${{ github.ref_name }}.md generate_release_notes: true prerelease: ${{ contains(github.ref_name, 'preview') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') }} diff --git a/build.gradle.kts b/build.gradle.kts index e62d10d..7f02541 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,3 +30,16 @@ allprojects { apply(plugin = "suspend-transform.nexus-publish") +tasks.create("createChangelog") { + group = "documentation" + doFirst { + val tag = "v${IProject.version}" + val changelogDir = rootProject.file(".changelog").apply { mkdirs() } + with(File(changelogDir, "$tag.md")) { + if (!exists()) { + createNewFile() + } + writeText("Kotlin version: `v${libs.versions.kotlin.get()}`") + } + } +}