diff --git a/.github/workflows/backend-publish.yml b/.github/workflows/backend-publish.yml new file mode 100644 index 0000000..fbf9965 --- /dev/null +++ b/.github/workflows/backend-publish.yml @@ -0,0 +1,36 @@ +name: Create Backend Release +on: + push: + branches: + - master +jobs: + build-and-deploy: + concurrency: ci-${{ github.ref }} + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Build project + run: | + cd backend + ./gradlew build + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: release_${{ github.run_number }} + release_name: Release #${{ github.run_number }} + draft: false + prerelease: false + - name: Upload Release Asset + id: 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: ./backend/build/libs/linkie-web-backend.jar + asset_name: linkie-web-backend.jar + asset_content_type: application/java-archive \ No newline at end of file diff --git a/backend/build.gradle b/backend/build.gradle index 0944e81..a4dc69c 100644 --- a/backend/build.gradle +++ b/backend/build.gradle @@ -1,6 +1,7 @@ plugins { id "org.jetbrains.kotlin.jvm" version "1.6.21" id "org.jetbrains.kotlin.plugin.serialization" version "1.6.21" + id "com.github.johnrengelman.shadow" version "7.0.0" } group = "me.shedaniel" @@ -20,8 +21,14 @@ repositories { maven { url "https://maven.quiltmc.org/repository/release" } } +configurations { + shadow { + extendsFrom(implementation) + } +} + dependencies { - implementation("me.shedaniel:linkie-core:1.0.96") + implementation("me.shedaniel:linkie-core:1.0.101") implementation("io.ktor:ktor-server-cors:2.0.1") implementation("io.ktor:ktor-server-content-negotiation:2.0.1") implementation("io.ktor:ktor-server-status-pages:2.0.1") @@ -34,6 +41,24 @@ dependencies { implementation 'io.ktor:ktor-client-core-jvm:2.0.2' } +jar { + classifier "raw" +} + +shadowJar { + configurations = [project.configurations.shadow] + classifier null + version null + mergeServiceFiles() + manifest { + attributes( + "Main-Class": "me.shedaniel.linkie.web.LinkieWebServerKt" + ) + } +} + +build.finalizedBy shadowJar + compileKotlin { kotlinOptions.jvmTarget = '1.8' } diff --git a/backend/src/main/kotlin/me/shedaniel/linkie/web/LinkieWebServer.kt b/backend/src/main/kotlin/me/shedaniel/linkie/web/LinkieWebServer.kt index 2eab6b5..2a01e9e 100644 --- a/backend/src/main/kotlin/me/shedaniel/linkie/web/LinkieWebServer.kt +++ b/backend/src/main/kotlin/me/shedaniel/linkie/web/LinkieWebServer.kt @@ -24,7 +24,6 @@ import me.shedaniel.linkie.getMappedDesc import me.shedaniel.linkie.getObfMergedDesc import me.shedaniel.linkie.obfMergedName import me.shedaniel.linkie.utils.MemberEntry -import me.shedaniel.linkie.utils.ResultHolder import me.shedaniel.linkie.utils.toVersion import me.shedaniel.linkie.utils.tryToVersion import me.shedaniel.linkie.web.deps.Deps