Skip to content

Merge pull request #30 from simple-robot/dev/support-jvm-bot-requests #44

Merge pull request #30 from simple-robot/dev/support-jvm-bot-requests

Merge pull request #30 from simple-robot/dev/support-jvm-bot-requests #44

name: Publish Snapshot
on:
push:
branches:
- main
- master
- dev/ver/**
- dev/main
paths:
- 'buildSrc'
- '**src/**/kotlin/**.kt'
- '**src/**/java/**.java'
- '**/src/**/kotlin/**.kt'
- '**/src/**/java/**.java'
- '**/build.gradle.kts'
- 'build.gradle.kts'
- 'settings.gradle.kts'
- 'gradle.properties'
# 手动触发工作流
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 }}
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 }}
SIMBOT_IS_SNAPSHOT: true
SIMBOT_SNAPSHOT_ONLY: true
GRADLE_OPTS: "-Dfile.encoding=UTF-8"
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-snapshot:
name: Publish snapshot
needs: run-test
runs-on: macos-latest
steps:
# 检出仓库代码
- name: Check out repo
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
- uses: gradle/actions/setup-gradle@v3
with:
gradle-version: ${{ env.GRADLE_VERSION }}
- 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
if: ${{ always() }}
with:
name: test-reports-${{ runner.os }}
path: '**/build/reports/tests'
retention-days: 7
deploy-doc:
name: Deploy-doc
runs-on: ubuntu-latest
needs: publish-snapshot
steps:
# 检出仓库代码
- name: Check out repo
uses: actions/checkout@v4
with:
persist-credentials: false
fetch-depth: 0
# setup Java
- name: Setup java
uses: actions/setup-java@v4
with:
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
- 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/snapshots/component-telegram
publish_dir: ./build/dokka/html
# deploy to sub dir
destination_dir: snapshots/components/telegram