Skip to content

Commit

Permalink
Merge pull request #13 from simple-robot/dev/main
Browse files Browse the repository at this point in the history
Release: v0.0.5
  • Loading branch information
ForteScarlet authored Jul 18, 2024
2 parents 656d55e + ceabed8 commit fca9ed1
Show file tree
Hide file tree
Showing 15 changed files with 172 additions and 274 deletions.
7 changes: 7 additions & 0 deletions .changelog/v0.0.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
> 对应核心版本: [**v4.1.0**](https://github.com/simple-robot/simpler-robot/releases/tag/v4.1.0)

我们欢迎并期望着您的的[反馈](https://github.com/simple-robot/simbot-component-telegram/issues)[协助](https://github.com/simple-robot/simbot-component-telegram/pulls)
感谢您的贡献与支持!

也欢迎您为我们献上一颗 `star`,这是对我们最大的鼓励与认可!
107 changes: 43 additions & 64 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
- v**

env:
JAVA_VERSION: 21
JAVA_DISTRIBUTION: zulu
GRADLE_VERSION: 8.5
IS_CI: true
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
Expand All @@ -14,57 +17,71 @@ env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GRADLE_OPTS: "-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"

SIMBOT_IS_SNAPSHOT: false
SIMBOT_RELEASES_ONLY: true

jobs:
run-test-and-publish:
name: Run test and publish
run-test:
name: Run all tests
strategy:
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
# 检出仓库代码
- name: Check Out Repo
uses: actions/checkout@v4

- uses: actions/checkout@v4
# setup Java
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'

# setup Gradle
- name: Gradle Run Test
# https://github.com/gradle/actions/blob/main/docs/setup-gradle.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
arguments: assemble test -Porg.gradle.daemon=false
gradle-version: ${{ env.GRADLE_VERSION }}

- name: Run all tests
run: gradle assemble allTests --stacktrace --warning-mode all

publish-release:
name: Publish release
needs: run-test
runs-on: macos-latest
steps:
# 检出仓库代码
- uses: actions/checkout@v4
# setup Java
- uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'

# setup Gradle
- name: Publish Release
- name: Publish releases
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
gradle-version: ${{ env.GRADLE_VERSION }}
arguments: |
publishToSonatype
closeAndReleaseStagingRepositories
publishToSonatype
closeAndReleaseStagingRepositories
--info
--warning-mode all
-x test
--build-cache
--warning-mode all
-x test
--build-cache
-Porg.gradle.jvmargs="-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
env:
SIMBOT_IS_SNAPSHOT: false
SIMBOT_RELEASES_ONLY: true

create-release:
name: Create release
runs-on: ubuntu-latest
needs: run-test-and-publish
needs: publish-release
permissions:
contents: write
steps:
Expand All @@ -82,49 +99,10 @@ jobs:
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, 'preview') || contains(github.ref_name, 'alpha') }}

# || contains(github.ref_name, 'beta')

publish-snapshot:
name: Publish snapshot
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
runs-on: ${{ matrix.os }}
needs: run-test-and-publish
steps:
# 检出仓库代码
- name: Check out repo
uses: actions/checkout@v4

# setup Java
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21

# setup Gradle
- name: Gradle publish snapshot
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
arguments: |
publishToSonatype
closeAndReleaseStagingRepositories
--info
--warning-mode all
-x test
--build-cache
-Porg.gradle.jvmargs="-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8"
-Porg.gradle.daemon=false
env:
SIMBOT_IS_SNAPSHOT: true
SIMBOT_SNAPSHOT_ONLY: true

deploy-doc:
name: Deploy-doc
runs-on: ubuntu-latest
needs: run-test-and-publish
needs: publish-release
steps:
# 检出仓库代码
- name: Check out repo
Expand All @@ -136,14 +114,15 @@ jobs:
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'

# setup Gradle
- name: Gradle generate documentation
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.5
gradle-version: ${{ env.GRADLE_VERSION }}
arguments: |
dokkaHtmlMultiModule
--info
Expand Down
51 changes: 42 additions & 9 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ on:
workflow_dispatch:

env:
JAVA_VERSION: 21
JAVA_DISTRIBUTION: zulu
GRADLE_VERSION: 8.5
IS_CI: true
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
Expand All @@ -35,12 +38,36 @@ env:


jobs:
publish-snapshot:
name: Publish snapshot
run-test:
name: Run all tests
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
os: [ macos-latest, ubuntu-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
# 检出仓库代码
- uses: actions/checkout@v4
# setup Java
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'
# setup Gradle
# https://github.com/gradle/actions/blob/main/docs/setup-gradle.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ env.GRADLE_VERSION }}

- name: Run all tests
run: gradle assemble allTests --stacktrace --warning-mode all

publish-snapshot:
name: Publish snapshot
needs: run-test
runs-on: macos-latest
steps:
# 检出仓库代码
- name: Check out repo
Expand All @@ -50,14 +77,17 @@ jobs:
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'

# setup Gradle
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ env.GRADLE_VERSION }}

- name: Gradle test and publish snapshot
run: gradle allTests publishToSonatype closeAndReleaseStagingRepositories --info --warning-mode all "-Porg.gradle.daemon=false" "-Porg.gradle.jvmargs='-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8'"
- name: Publish snapshots
run: gradle publishToSonatype closeAndReleaseStagingRepositories --info --warning-mode all -x test "-Porg.gradle.jvmargs='-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8'"

- name: Upload test reports
uses: actions/upload-artifact@v4
Expand All @@ -82,11 +112,14 @@ jobs:
- name: Setup java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
distribution: ${{ env.JAVA_DISTRIBUTION }}
java-version: ${{ env.JAVA_VERSION }}
cache: 'gradle'

# setup Gradle
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ env.GRADLE_VERSION }}

- run: gradle dokkaHtmlMultiModule "-Porg.gradle.jvmargs='-Xmx4g -Xms4g -XX:MaxMetaspaceSize=2g -Dfile.encoding=UTF-8'" "-Porg.gradle.daemon=false" "-DisSnapshot=false" --info --warning-mode all -x test --build-cache

Expand Down
11 changes: 4 additions & 7 deletions buildSrc/src/main/kotlin/P.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
*/

import love.forte.gradle.common.core.project.ProjectDetail
import love.forte.gradle.common.core.project.Version
import love.forte.gradle.common.core.project.minus
import love.forte.gradle.common.core.property.systemProp
import love.forte.gradle.common.core.project.version as v


/**
Expand All @@ -43,11 +40,11 @@ object P {
override val description: String get() = DESCRIPTION
override val homepage: String get() = HOMEPAGE

const val VERSION = "0.0.5"
const val NEXT_VERSION = "0.0.6"

private val baseVersion = v(0, 0, 4)

val snapshotVersion = baseVersion - Version.SNAPSHOT
override val version = if (isSnapshot()) snapshotVersion else baseVersion
override val snapshotVersion = "$NEXT_VERSION-SNAPSHOT"
override val version = if (isSnapshot()) snapshotVersion else VERSION

override val developers: List<Developer> = developers {
developer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tasks.create("createChangelog") {
appendLine(
"""
> [!warning]
> **目前版本处于 `dev` 阶段,代表此版本是一个开发预览版,可能不稳定、可能随时发生更改、且不保证可用性。**
> **目前版本处于早期阶段,代表此版本是一个开发预览版,可能不稳定、可能随时发生更改、且不保证可用性。**
""".trimIndent()
Expand All @@ -64,42 +64,3 @@ tasks.create("createChangelog") {
}
}
}

tasks.create("updateWebsiteVersionJson") {
group = "documentation"
doFirst {
val version = P.ComponentTelegram.version.toString()

val websiteVersionJsonDir = rootProject.file("website/static")
if (!websiteVersionJsonDir.exists()) {
websiteVersionJsonDir.mkdirs()
}
val websiteVersionJsonFile = File(websiteVersionJsonDir, "version.json")
if (!websiteVersionJsonFile.exists()) {
websiteVersionJsonFile.createNewFile()
}

websiteVersionJsonFile.writeText(
"""
{
"version": "$version"
}
""".trimIndent()
)
}
}


fun repoRow(moduleName: String, group: String, id: String, version: String): String {
return "| $moduleName | [$moduleName: v$version](https://repo1.maven.org/maven2/${
group.replace(
".",
"/"
)
}/${
id.replace(
".",
"/"
)
}/$version) | [$moduleName: v$version](https://search.maven.org/artifact/$group/$id/$version/jar) |"
}
Loading

0 comments on commit fca9ed1

Please sign in to comment.