Skip to content

Commit

Permalink
Add spi publish
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoii committed Feb 10, 2023
1 parent a685319 commit 1eff1e5
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 16 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,24 @@ jobs:
- name: Build with Gradle
run: ./gradlew buildCiJar

- name: Build SPI
run: ./gradlew buildSpi

- name: Publish to Maven Central
run: ./gradlew mirai-api-http:publish --info --scan
env:
PUBLICATION_CREDENTIALS: ${{ secrets.PUBLICATION_CREDENTIALS }}

- name: Publish to SPI Maven Central
run: ./gradlew mirai-api-http-spi:publish --info --scan
env:
PUBLICATION_CREDENTIALS: ${{ secrets.PUBLICATION_CREDENTIALS }}

- name: Get Tag
id: tag
uses: dawidd6/action-get-tag@v1
run: |
tag=$(echo ${{ github.ref }} | cut -dv -f2)
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Generate Line Temp File
run: "cat CHANGELOG.md | grep -n '## \\\\' | cut -d: -f1 | head -n 2 >> line.tmp"
Expand All @@ -46,25 +56,15 @@ jobs:

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
release_name: mirai-api-http-${{ steps.tag.outputs.tag }}
name: mirai-api-http-${{ steps.tag.outputs.tag }}
body_path: release.log
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./mirai-api-http/build/ci/mirai-api-http.jar
asset_name: mirai-api-http-${{ steps.tag.outputs.tag }}.mirai2.jar
asset_content_type: application/zip
files: |
./mirai-api-http/build/ci/mirai-api-http-${{ steps.tag.outputs.tag }}.mirai2.jar
- name: Clone Mirai-Repo
uses: actions/checkout@v3
Expand Down
26 changes: 26 additions & 0 deletions mirai-api-http-spi/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ plugins {
id("me.him188.maven-central-publish")
}

val httpVersion: String by rootProject.extra
project.version = httpVersion

dependencies {

}
Expand All @@ -20,4 +23,27 @@ tasks {
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
}

tasks.register("buildSpi", Jar::class) {
dependsOn("build")
doLast {
val jarTask = tasks.getByName("jar", Jar::class)
val buildPluginFile = jarTask.archiveFile.get().asFile
project.buildDir.resolve("ci").also {
it.mkdirs()
}.resolve("mirai-api-http-spi-${{ project.version }}.jar").let {
buildPluginFile.copyTo(it, true)
}
}
}

mavenCentralPublish {
workingDir = rootProject.buildDir.resolve("pub").apply { mkdirs() }
githubProject("project-mirai", "mirai-api-http-spi")
licenseFromGitHubProject("licenseAgplv3", "master")
developer("Mamoe Technologies")
publication {
artifact(tasks.getByName("buildSpi"))
}
}
2 changes: 1 addition & 1 deletion mirai-api-http/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ tasks.register("buildCiJar", Jar::class) {
val buildPluginFile = buildPluginTask.archiveFile.get().asFile
project.buildDir.resolve("ci").also {
it.mkdirs()
}.resolve("mirai-api-http.jar").let {
}.resolve("mirai-api-http-${{ project.version }}.mirai2.jar").let {
buildPluginFile.copyTo(it, true)
}
}
Expand Down

0 comments on commit 1eff1e5

Please sign in to comment.