Merge pull request #805 from simple-robot/common-ktor-inputfile #91
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 v4 Snapshot | |
on: # push | |
workflow_dispatch: | |
push: | |
branches: | |
- v4-dev | |
- v4-dev-snapshot** | |
- v4.*.** | |
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' | |
env: | |
IS_CI: true | |
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} | |
GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }} | |
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SIMBOT_IS_SNAPSHOT: true | |
SIMBOT_SNAPSHOT_ONLY: true | |
GRADLE_OPTS: "-XX:MaxMetaspaceSize=2g -Dfile.encoding=UTF-8" | |
jobs: | |
publish-v4-snapshot: | |
name: Publish v4 snapshot | |
strategy: | |
matrix: | |
os: [ macos-latest, windows-latest, ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
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 | |
cache: 'gradle' | |
# setup Node | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Run All Tests | |
uses: gradle/gradle-build-action@v3 | |
with: | |
gradle-version: 8.5 | |
arguments: assemble allTests --info --warning-mode all --build-cache -Porg.gradle.daemon=false | |
- name: Gradle publish snapshot | |
uses: gradle/gradle-build-action@v3 | |
with: | |
gradle-version: 8.5 | |
arguments: | | |
publishToSonatype | |
closeAndReleaseStagingRepository | |
--info | |
--warning-mode all | |
-x test | |
--build-cache | |
-Porg.gradle.jvmargs="-Xms4G -XX:MaxMetaspaceSize=1G -Dfile.encoding=UTF-8" | |
-Porg.gradle.parallel=false | |
# parallel=true 容易出现 Metaspace 的异常 | |
# -Porg.gradle.daemon=false | |
deploy-doc: | |
name: Deploy snapshots API doc | |
needs: publish-v4-snapshot | |
runs-on: macos-latest # ubuntu-latest | |
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: 'zulu' | |
java-version: 21 | |
cache: 'gradle' | |
# setup Gradle | |
- name: Gradle generate documentation | |
uses: gradle/gradle-build-action@v3 | |
with: | |
gradle-version: 8.5 | |
arguments: | | |
dokkaHtmlMultiModule | |
--info | |
--warning-mode all | |
-x test | |
--build-cache | |
-Porg.gradle.jvmargs="-Xms4G -XX:MaxMetaspaceSize=1G -Dfile.encoding=UTF-8" | |
-Porg.gradle.parallel=false | |
# -Porg.gradle.daemon=false | |
env: | |
SIMBOT_IS_SNAPSHOT: true | |
# https://github.com/marketplace/actions/github-pages-action | |
- 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/main-v4 | |
publish_dir: ./build/dokka/html | |
destination_dir: snapshots/main-v4 |