optimize: 优化改善与 SourceResource 相关的API #40
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 V4 Release | |
on: | |
push: | |
tags: | |
- v4.**.** | |
env: | |
JAVA_VERSION: 21 | |
JAVA_DISTRIBUTION: zulu | |
GRADLE_VERSION: 8.5 | |
NODE_VERSION: 22 | |
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 }} | |
GRADLE_OPTS: "-Dfile.encoding=UTF-8" | |
jobs: | |
test-pre-release: | |
name: Test pre release | |
strategy: | |
matrix: | |
os: [ macos-latest, windows-latest, ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: 'gradle' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Run All Tests pre release | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: ${{ env.GRADLE_VERSION }} | |
- run: gradle assemble allTests -s | |
- name: Upload test reports | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-reports-${{ runner.os }} | |
path: '**/build/reports/tests' | |
retention-days: 7 | |
test-and-publish-v4-release: | |
name: Publish v4 Release | |
needs: test-pre-release | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: 'gradle' | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
# setup Gradle | |
- name: Gradle Publish Release | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: ${{ env.GRADLE_VERSION }} | |
arguments: | | |
publishToSonatype | |
closeAndReleaseStagingRepositories | |
-s | |
--warning-mode all | |
-x test | |
--build-cache | |
-Porg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8" | |
env: | |
SIMBOT_IS_SNAPSHOT: false | |
SIMBOT_RELEASES_ONLY: true | |
SIMBOT_SNAPSHOT_ONLY: false | |
publish-v4-snapshot: | |
name: Publish V4 snapshot | |
runs-on: macos-latest | |
needs: test-and-publish-v4-release | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: 'gradle' | |
# setup Gradle | |
- name: Gradle publish snapshot | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: ${{ env.GRADLE_VERSION }} | |
arguments: | | |
publishToSonatype | |
closeAndReleaseStagingRepositories | |
-s | |
--warning-mode all | |
-x test | |
--build-cache | |
-Porg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8" | |
env: | |
SIMBOT_IS_SNAPSHOT: true | |
SIMBOT_SNAPSHOT_ONLY: true | |
SIMBOT_RELEASES_ONLY: false | |
deploy-doc: | |
name: Deploy V4 API Doc | |
needs: test-and-publish-v4-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- uses: actions/setup-java@v4 | |
with: | |
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: ${{ env.GRADLE_VERSION }} | |
arguments: | | |
dokkaHtmlMultiModule | |
--info | |
--warning-mode all | |
-x test | |
--build-cache | |
-Porg.gradle.jvmargs="-XX:MaxMetaspaceSize=1g -Dfile.encoding=UTF-8" | |
-Porg.gradle.daemon=false | |
env: | |
SIMBOT_IS_SNAPSHOT: false | |
# 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/main-v4 | |
publish_dir: ./build/dokka/html | |
destination_dir: main-v4 | |
create-release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
needs: [ deploy-doc ] | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ env.JAVA_DISTRIBUTION }} | |
java-version: ${{ env.JAVA_VERSION }} | |
cache: 'gradle' | |
# setup Gradle | |
- name: Gradle publish snapshot | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: ${{ env.GRADLE_VERSION }} | |
arguments: createChangelog | |
# Create gitHub release | |
# https://github.com/marketplace/actions/gh-release | |
- name: Create Github Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.PUSH_TOKEN }} | |
body_path: .changelog/${{ github.ref_name }}.md | |
generate_release_notes: true | |
prerelease: ${{ contains(github.ref_name, 'preview') || contains(github.ref_name, 'alpha') || contains(github.ref_name, 'dev') }} | |
# || contains(github.ref_name, 'beta') |