2021-02-06 15:41:09 +08:00
|
|
|
name: Release Publish
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
2021-09-01 13:47:02 +08:00
|
|
|
- 'v*' # 正式版本
|
2022-07-02 16:10:20 +08:00
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
2022-07-04 00:00:23 +08:00
|
|
|
- 'mirai-console/docs/**'
|
|
|
|
- '**/*.md'
|
|
|
|
|
2021-02-06 15:41:09 +08:00
|
|
|
|
|
|
|
jobs:
|
2022-11-28 00:05:51 +08:00
|
|
|
initialize-sonatype-stage:
|
|
|
|
name: "Initialize sonatype staging repository"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-02-21 07:56:20 +08:00
|
|
|
- uses: actions/checkout@v3
|
2022-11-28 00:05:51 +08:00
|
|
|
with:
|
|
|
|
submodules: 'recursive'
|
|
|
|
|
2023-02-21 07:56:20 +08:00
|
|
|
- uses: actions/setup-java@v3
|
2022-11-28 00:05:51 +08:00
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '17'
|
|
|
|
|
|
|
|
- name: Setup Gradle
|
|
|
|
uses: gradle/gradle-build-action@v2
|
|
|
|
|
|
|
|
- run: chmod -R 777 *
|
|
|
|
|
|
|
|
- name: Create publishing staging repository
|
|
|
|
run: ./gradlew runcihelper --args create-stage-repo --scan "-Pcihelper.cert.username=${{ secrets.SONATYPE_USER }}" "-Pcihelper.cert.password=${{ secrets.SONATYPE_KEY }}" "-Pcihelper.cert.profileid=${{ secrets.SONATYPE_PROFILEID }}"
|
|
|
|
|
|
|
|
- name: Cache staging repository id
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: publish-stage-id
|
|
|
|
path: ci-release-helper/repoid
|
2021-02-06 15:41:09 +08:00
|
|
|
|
2022-07-04 00:00:23 +08:00
|
|
|
publish-others:
|
|
|
|
name: "Others (${{ matrix.os }})"
|
2022-07-02 16:10:20 +08:00
|
|
|
runs-on: ${{ matrix.os }}
|
2022-11-28 00:05:51 +08:00
|
|
|
needs: [ initialize-sonatype-stage ]
|
2022-07-02 16:10:20 +08:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os:
|
|
|
|
- macos-12
|
|
|
|
env:
|
2022-10-19 23:30:20 +08:00
|
|
|
# All targets MUST be enabled. See #2270.
|
2022-11-26 07:53:37 +08:00
|
|
|
gradleArgs: --scan "-Dmirai.target=other" "-Pkotlin.compiler.execution.strategy=in-process"
|
2022-07-02 16:10:20 +08:00
|
|
|
isMac: ${{ startsWith(matrix.os, 'macos') }}
|
|
|
|
isWindows: ${{ startsWith(matrix.os, 'windows') }}
|
|
|
|
isUbuntu: ${{ startsWith(matrix.os, 'ubuntu') }}
|
|
|
|
isUnix: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') }}
|
|
|
|
steps:
|
2023-02-21 07:56:20 +08:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-06 15:41:09 +08:00
|
|
|
with:
|
2022-07-02 16:10:20 +08:00
|
|
|
submodules: 'recursive'
|
2021-02-06 15:41:09 +08:00
|
|
|
|
2023-02-21 07:56:20 +08:00
|
|
|
- uses: actions/setup-java@v3
|
2022-07-02 16:10:20 +08:00
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '17'
|
2021-02-06 15:41:09 +08:00
|
|
|
|
|
|
|
- name: Keys setup
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
mkdir build-gpg-sign
|
|
|
|
echo "$GPG_PRIVATE" > build-gpg-sign/keys.gpg
|
|
|
|
echo "$GPG_PUBLIC_" > build-gpg-sign/keys.gpg.pub
|
|
|
|
env:
|
|
|
|
GPG_PRIVATE: ${{ secrets.GPG_PRIVATE_KEY }}
|
|
|
|
GPG_PUBLIC_: ${{ secrets.GPG_PUBLIC_KEY }}
|
|
|
|
|
2023-04-21 17:59:48 +08:00
|
|
|
- name: Setup Android SDK Ubuntu
|
|
|
|
if: ${{ env.isUbuntu == 'true' }}
|
|
|
|
run: 'touch local.properties && echo sdk.dir=/usr/local/lib/android/sdk >> local.properties'
|
|
|
|
|
|
|
|
- name: Setup Android SDK macOS
|
|
|
|
if: ${{ env.isMac == 'true' }}
|
|
|
|
run: 'touch local.properties && echo sdk.dir=/Users/runner/Library/Android/sdk >> local.properties'
|
|
|
|
|
|
|
|
- name: Setup Android SDK Windows
|
|
|
|
if: ${{ env.isWindows == 'true' }}
|
|
|
|
run: 'echo sdk.dir=C:\Android\android-sdk >> local.properties'
|
|
|
|
|
2022-07-02 16:10:20 +08:00
|
|
|
- name: Setup Gradle
|
|
|
|
uses: gradle/gradle-build-action@v2
|
2021-02-06 16:38:43 +08:00
|
|
|
|
2022-07-02 16:10:20 +08:00
|
|
|
- name: Cache konan
|
2022-11-17 20:21:41 +08:00
|
|
|
uses: pat-s/always-upload-cache@v3.0.11
|
2022-07-02 16:10:20 +08:00
|
|
|
with:
|
|
|
|
path: ~/.konan
|
|
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('*.gradle.kts') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-gradle-
|
2021-02-06 15:41:09 +08:00
|
|
|
|
2022-07-02 16:10:20 +08:00
|
|
|
- if: ${{ env.isUnix == 'true' }}
|
|
|
|
run: chmod -R 777 *
|
2021-02-06 15:41:09 +08:00
|
|
|
|
2022-07-02 16:10:20 +08:00
|
|
|
# Prepare environment for linking for macOS
|
2021-02-06 15:41:09 +08:00
|
|
|
|
2022-07-02 16:10:20 +08:00
|
|
|
- name: Clean and download dependencies
|
|
|
|
run: ./gradlew clean ${{ env.gradleArgs }}
|
|
|
|
|
|
|
|
- name: "Assemble"
|
|
|
|
run: ./gradlew assemble ${{ env.gradleArgs }}
|
|
|
|
|
|
|
|
- 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 ${{ env.gradleArgs }}
|
|
|
|
|
|
|
|
- if: ${{ env.isMac == 'true' }}
|
|
|
|
name: Ensure KDoc valid
|
2022-07-04 00:00:23 +08:00
|
|
|
run: ./gradlew dokkaHtmlMultiModule ${{ env.gradleArgs }}
|
2022-07-02 16:10:20 +08:00
|
|
|
|
2022-11-28 00:05:51 +08:00
|
|
|
- name: Initialize Publishing Caching Repository
|
|
|
|
run: ./gradlew runcihelper --args sync-maven-metadata ${{ env.gradleArgs }}
|
|
|
|
|
2022-07-02 16:10:20 +08:00
|
|
|
- name: Publish
|
|
|
|
if: ${{ env.isMac == 'true' }}
|
2022-11-28 00:05:51 +08:00
|
|
|
run: ./gradlew publishAllPublicationsToMiraiStageRepoRepository ${{ env.gradleArgs }}
|
|
|
|
|
|
|
|
- name: Restore staging repository id
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: publish-stage-id
|
|
|
|
path: ci-release-helper/repoid
|
|
|
|
|
2022-11-29 09:41:33 +08:00
|
|
|
- name: Release RAM
|
|
|
|
run: node ci-release-helper/scripts/kill-java.js
|
|
|
|
|
2022-11-28 00:05:51 +08:00
|
|
|
- name: Publish to maven central
|
|
|
|
run: ./gradlew runcihelper --args publish-to-maven-central --scan "-Pcihelper.cert.username=${{ secrets.SONATYPE_USER }}" "-Pcihelper.cert.password=${{ secrets.SONATYPE_KEY }}"
|
2021-02-06 15:41:09 +08:00
|
|
|
|
2021-02-07 15:28:29 +08:00
|
|
|
- name: Publish Gradle plugin
|
2022-07-02 16:10:20 +08:00
|
|
|
run: ./gradlew
|
|
|
|
:mirai-console-gradle:publishPlugins ${{ env.gradleArgs }}
|
2021-02-07 15:28:29 +08:00
|
|
|
-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 }}
|
2022-11-28 00:05:51 +08:00
|
|
|
continue-on-error: true
|
2021-02-06 22:28:09 +08:00
|
|
|
|
2022-11-26 07:53:37 +08:00
|
|
|
#
|
|
|
|
# close-repository:
|
|
|
|
# runs-on: macos-12
|
|
|
|
# needs:
|
|
|
|
# - publish-others
|
|
|
|
# - publish-core-native
|
|
|
|
# steps:
|
2023-02-21 07:56:20 +08:00
|
|
|
# - uses: actions/checkout@v3
|
2022-11-26 07:53:37 +08:00
|
|
|
# with:
|
|
|
|
# submodules: 'recursive'
|
|
|
|
#
|
2023-02-21 07:56:20 +08:00
|
|
|
# - uses: actions/setup-java@v3
|
2022-11-26 07:53:37 +08:00
|
|
|
# with:
|
|
|
|
# distribution: 'adopt-openj9'
|
|
|
|
# java-version: '17'
|
|
|
|
#
|
|
|
|
# - name: Setup Gradle
|
|
|
|
# uses: gradle/gradle-build-action@v2
|
|
|
|
#
|
|
|
|
# - name: Close repository
|
|
|
|
# run: ./gradlew :ci-release-helper:closeRepository --scan
|