release: v1.1.0 #20
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Release | |
on: | |
push: | |
tags: | |
- v** | |
env: | |
JAVA_VERSION: 21 | |
JAVA_DISTRIBUTION: zulu | |
IS_CI: true | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | |
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} | |
OSSRH_USER: ${{ secrets.SONATYPE_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
GRADLE_OPTS: "-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8" | |
GRADLE_VERSION: 8.5 | |
jobs: | |
run-test: | |
name: Run all tests | |
strategy: | |
matrix: | |
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-releases: | |
name: Publish releases | |
needs: run-test | |
# 交叉编译 support | |
# see https://kotlinlang.org/docs/multiplatform-publish-lib.html#host-requirements | |
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 releases | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: ${{ env.GRADLE_VERSION }} | |
arguments: | | |
publishToSonatype | |
closeAndReleaseStagingRepositories | |
--info | |
--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: publish-releases | |
permissions: | |
contents: write | |
steps: | |
# 检出仓库代码 | |
- uses: actions/checkout@v4 | |
# Create gitHub release | |
- name: Create Github Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.PUSH_TOKEN }} | |
body: '${{ github.ref_name }}' | |
body_path: .changelog/${{ github.ref_name }}.md | |
generate_release_notes: true | |
prerelease: ${{ contains(github.ref_name, 'preview') || contains(github.ref_name, 'alpha') }} | |
publish-snapshots: | |
name: Publish snapshots | |
# 交叉编译 support | |
# see https://kotlinlang.org/docs/multiplatform-publish-lib.html#host-requirements | |
runs-on: macos-latest | |
needs: publish-releases | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
# setup Gradle | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: ${{ env.GRADLE_VERSION }} | |
arguments: | | |
publishToSonatype | |
closeAndReleaseStagingRepositories | |
--info | |
--warning-mode all | |
-x test | |
--build-cache | |
-Porg.gradle.jvmargs="-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8" | |
env: | |
SIMBOT_IS_SNAPSHOT: true | |
SIMBOT_SNAPSHOT_ONLY: true | |
deploy-doc: | |
name: Deploy KDoc | |
runs-on: ubuntu-latest | |
needs: publish-releases | |
steps: | |
# 检出仓库代码 | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
# setup Java | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Generate documentation | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: ${{ env.GRADLE_VERSION }} | |
arguments: | | |
dokkaHtmlMultiModule | |
--info | |
--warning-mode all | |
-x test | |
--build-cache | |
-Porg.gradle.jvmargs="-Xmx8g -Xms2g -XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8" | |
- name: Push to doc repository | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.PUSH_TOKEN }} | |
external_repository: simple-robot-library/simbot3-api-docs | |
publish_branch: kdoc-deploy/component-onebot | |
publish_dir: ./build/dokka/html | |
# deploy to sub dir | |
destination_dir: components/onebot |