diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6eadebf55..43889e178 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,11 +5,13 @@ on: push: paths-ignore: - 'docs/**' - - '**/README*.md' + - 'mirai-console/docs/**' + - '**/*.md' pull_request: paths-ignore: - 'docs/**' - - '**/README*.md' + - 'mirai-console/docs/**' + - '**/*.md' jobs: build-mirai-jvm: @@ -22,7 +24,7 @@ jobs: # - windows-2022 - macos-12 env: - gradleArgs: --scan "-Dmirai.target=jvm;android;!other" "-Pkotlin.compiler.execution.strategy=in-process" "-Dorg.gradle.jvmargs=-Xmx6000m -Dfile.encoding=UTF-8" + gradleArgs: --scan "-Dmirai.target=jvm;android;!other" "-Pkotlin.compiler.execution.strategy=in-process" "-Dorg.gradle.jvmargs=-Xmx6000m" "-Dfile.encoding=UTF-8" isMac: ${{ startsWith(matrix.os, 'macos') }} isWindows: ${{ startsWith(matrix.os, 'windows') }} isUbuntu: ${{ startsWith(matrix.os, 'ubuntu') }} @@ -289,6 +291,7 @@ jobs: - run: > ./gradlew updateSnapshotVersion ${{ env.gradleArgs }} + if: github.event.push env: MIRAI_IS_SNAPSHOTS_PUBLISHING: true SNAPSHOTS_PUBLISHING_USER: ${{ secrets.SNAPSHOTS_PUBLISHING_USER }} @@ -308,10 +311,10 @@ jobs: - if: ${{ env.isMac == 'true' }} name: Ensure KDoc valid - run: ./gradlew dokkaHtmlMultiModule + run: ./gradlew dokkaHtmlMultiModule ${{ env.gradleArgs }} - name: Publish Snapshots - if: ${{ env.isMac == 'true' }} + if: ${{ github.event.push && env.isMac == 'true' }} run: ./gradlew publishAllPublicationsToMiraiRepoRepository ${{ env.gradleArgs }} env: MIRAI_IS_SNAPSHOTS_PUBLISHING: true @@ -430,6 +433,7 @@ jobs: - run: > ./gradlew updateSnapshotVersion ${{ env.gradleArgs }} + if: github.event.push env: MIRAI_IS_SNAPSHOTS_PUBLISHING: true SNAPSHOTS_PUBLISHING_USER: ${{ secrets.SNAPSHOTS_PUBLISHING_USER }} @@ -451,12 +455,13 @@ jobs: run: ./gradlew :mirai-deps-test:publishMiraiArtifactsToMavenLocal ${{ env.gradleArgs }} "-Dmirai.build.project.version=2.99.0-deps-test" - name: Check Publication + if: ${{ env.enableLocalPublishingTest == 'true' }} run: ./gradlew :mirai-deps-test:check ${{ env.gradleArgs }} # Publish native snapshots. Other artifacts are published in build-mirai-all - name: Publish MingwX64 Snapshots - if: ${{ env.isWindows == 'true' }} + if: ${{ github.event.push && env.isWindows == 'true' }} run: ./gradlew publishMingwX64PublicationToMiraiRepoRepository ${{ env.gradleArgs }} env: MIRAI_IS_SNAPSHOTS_PUBLISHING: true @@ -466,7 +471,7 @@ jobs: CURRENT_BRANCH_NAME: dev - name: Publish LinuxX64 Snapshots - if: ${{ env.isUbuntu == 'true' }} + if: ${{ github.event.push && env.isUbuntu == 'true' }} run: ./gradlew publishLinuxX64PublicationToMiraiRepoRepository ${{ env.gradleArgs }} env: MIRAI_IS_SNAPSHOTS_PUBLISHING: true @@ -476,7 +481,7 @@ jobs: CURRENT_BRANCH_NAME: dev - name: Publish macOSX64 Snapshots - if: ${{ env.isMac == 'true' }} + if: ${{ github.event.push && env.isMac == 'true' }} run: ./gradlew publishMacosX64PublicationToMiraiRepoRepository ${{ env.gradleArgs }} env: MIRAI_IS_SNAPSHOTS_PUBLISHING: true diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc108c588..28035e997 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,12 +6,14 @@ on: - 'v*' # 正式版本 paths-ignore: - 'docs/**' - - '**/README*.md' + - 'mirai-console/docs/**' + - '**/*.md' + jobs: - build-mirai-all: - name: "Everything (${{ matrix.os }})" + publish-others: + name: "Others (${{ matrix.os }})" runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -20,7 +22,7 @@ jobs: - macos-12 env: enableLocalPublishingTest: 'false' - gradleArgs: --scan + gradleArgs: --scan "-Dmirai.target=jvm;android;!other" "-Pkotlin.compiler.execution.strategy=in-process" isMac: ${{ startsWith(matrix.os, 'macos') }} isWindows: ${{ startsWith(matrix.os, 'windows') }} isUbuntu: ${{ startsWith(matrix.os, 'ubuntu') }} @@ -94,7 +96,7 @@ jobs: - if: ${{ env.isMac == 'true' }} name: Ensure KDoc valid - run: ./gradlew dokkaHtmlMultiModule + run: ./gradlew dokkaHtmlMultiModule ${{ env.gradleArgs }} - name: Publish if: ${{ env.isMac == 'true' }} @@ -106,7 +108,7 @@ jobs: -Dgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Pgradle.publish.key=${{ secrets.GRADLE_PUBLISH_KEY }} -Dgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} -Pgradle.publish.secret=${{ secrets.GRADLE_PUBLISH_SECRET }} - build-mirai-core-native: + publish-core-native: name: "Native (${{ matrix.os }})" runs-on: ${{ matrix.os }} strategy: @@ -115,20 +117,14 @@ jobs: os: - windows-2022 - ubuntu-20.04 - - ubuntu-18.04 - macos-12 - - macos-11 include: - os: windows-2022 targetName: mingwX64 - os: ubuntu-20.04 targetName: linuxX64 - - os: ubuntu-18.04 - targetName: linuxX64 - os: macos-12 targetName: macosX64 - - os: macos-11 - targetName: macosX64 env: # FIXME there must be two or more targets, or we'll get error on `@OptionalExpectation` # > Declaration annotated with '@OptionalExpectation' can only be used in common module sources @@ -265,8 +261,8 @@ jobs: close-repository: runs-on: macos-12 needs: - - publish-mirai-others - - publish-mirai-core-native + - publish-others + - publish-core-native steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/snapshots.yml b/.github/workflows/snapshots.yml deleted file mode 100644 index 2e467e6bc..000000000 --- a/.github/workflows/snapshots.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: Snapshots Publish - -on: - push: - branches: - - dev - - snapshots-publishing - paths-ignore: - - 'docs/**' - - '**/README*.md' - -jobs: - publish-mirai: - runs-on: macos-12 # 14G memory - env: - enableLocalPublishingTest: 'false' - gradleArgs: --scan "-Dmirai.target=android,jvm;macosX64;!other" "-Pkotlin.compiler.execution.strategy=in-process" "-Dfile.encoding=UTF-8" - steps: - - uses: actions/checkout@v2 - - run: git submodule update --init --recursive - - uses: actions/setup-java@v2 - with: - distribution: 'adopt' - java-version: '17' - - - run: chmod -R 777 * - - - name: Init gradle project - run: ./gradlew clean --scan - - - run: > - ./gradlew updateSnapshotVersion --info --scan - env: - MIRAI_IS_SNAPSHOTS_PUBLISHING: true - SNAPSHOTS_PUBLISHING_USER: ${{ secrets.SNAPSHOTS_PUBLISHING_USER }} - SNAPSHOTS_PUBLISHING_KEY: ${{ secrets.SNAPSHOTS_PUBLISHING_KEY }} - SNAPSHOTS_PUBLISHING_URL: ${{ secrets.SNAPSHOTS_PUBLISHING_URL }} - CURRENT_BRANCH_NAME: dev - - - name: Assemble - run: ./gradlew assemble --scan - - - name: Publish Local Artifacts - if: ${{ env.enableLocalPublishingTest == 'true' }} - run: ./gradlew :mirai-deps-test:publishMiraiArtifactsToMavenLocal ${{ env.gradleArgs }} "-Dmirai.build.project.version=2.99.0-deps-test" - - - name: Check - run: > - ./gradlew check --scan - -Dmirai.network.show.all.components=true - -Dkotlinx.coroutines.debug=on - -Dmirai.network.show.packet.details=true - -Dmirai.network.handle.selector.logging=true - - - run: > - ./gradlew publish --no-parallel --info --scan - env: - MIRAI_IS_SNAPSHOTS_PUBLISHING: true - SNAPSHOTS_PUBLISHING_USER: ${{ secrets.SNAPSHOTS_PUBLISHING_USER }} - SNAPSHOTS_PUBLISHING_KEY: ${{ secrets.SNAPSHOTS_PUBLISHING_KEY }} - SNAPSHOTS_PUBLISHING_URL: ${{ secrets.SNAPSHOTS_PUBLISHING_URL }} - CURRENT_BRANCH_NAME: dev - - - name: Release CI RAM - run: pkill java - continue-on-error: true - - run: > - ./gradlew publishSnapshotPage --info - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - continue-on-error: true