Skip to content

Commit 61d03fe

Browse files
committed
chore: fix publishing build
1 parent 5bb9803 commit 61d03fe

File tree

3 files changed

+18
-13
lines changed

3 files changed

+18
-13
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ jobs:
9494
echo "dist_path=$(ls -1 backend/build/distributions/*.zip | head -n 1)" >> "$GITHUB_OUTPUT"
9595
echo "dist_name=$(ls -1 backend/build/distributions/*.zip | head -n 1 | xargs basename)" >> "$GITHUB_OUTPUT"
9696
env:
97+
GITHUB_USER: ${{ github.repository_owner }}
9798
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9899
JOB_CONTEXT: ${{ toJSON(job) }}
99100
STEPS_CONTEXT: ${{ toJSON(steps) }}
@@ -175,14 +176,6 @@ jobs:
175176
fetch-depth: 0
176177
submodules: recursive
177178

178-
- name: 📦Publish artifacts to GitHub Packages
179-
id: gradle-deploy
180-
run: |
181-
./gradlew publishAllPublicationsToGitHubPackagesRepository
182-
env:
183-
GITHUB_USER: ${{ github.repository_owner }}
184-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
185-
186179
- name: ⚙️Build Changelog
187180
id: github_release
188181
uses: mikepenz/release-changelog-builder-action@v4

gradle/build-logic/common-plugins/src/main/kotlin/common/GithubAction.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object GithubAction {
3232
* @return true if the build is a tag build, false otherwise.
3333
*/
3434
val isTagBuild
35-
get() = Env.GITHUB_REF.startsWith("refs/tags/")
35+
get() = isEnabled && Env.GITHUB_REF.startsWith("refs/tags/")
3636

3737
/**
3838
* Returns the ref name (tag/branch) that triggered the GitHub workflow run.
@@ -42,8 +42,8 @@ object GithubAction {
4242
val ref
4343
get() =
4444
when (isTagBuild) {
45-
true -> Env.GITHUB_REF.substringAfter("refs/tags/")
46-
false -> Env.GITHUB_REF.substringAfter("refs/heads/")
45+
true -> Env.GITHUB_REF?.substringAfter("refs/tags/")
46+
false -> Env.GITHUB_REF?.substringAfter("refs/heads/")
4747
}
4848

4949
/**

gradle/build-logic/common-plugins/src/main/kotlin/plugins/common.gradle.kts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package plugins
22

33
import com.github.ajalt.mordant.rendering.TextColors
44
import common.*
5+
import common.Platform
56
import java.io.PrintWriter
67
import java.io.StringWriter
78
import java.util.spi.*
@@ -151,8 +152,19 @@ tasks {
151152

152153
register("ciBuild") {
153154
description = "Build with all the reports!"
154-
dependsOn(
155-
tasks.build, ":web:build", ":backend:build", "koverHtmlReport", "dokkaHtmlMultiModule")
155+
val publish = GithubAction.isTagBuild && Platform.isLinux
156+
val ciBuildTasks = buildList {
157+
add(tasks.build)
158+
add(":web:build")
159+
add(":backend:build")
160+
add("koverHtmlReport")
161+
add("dokkaHtmlMultiModule")
162+
if (publish) {
163+
logger.lifecycle("Publishing task is enabled for this build!")
164+
add("publishAllPublicationsToGitHubPackagesRepository")
165+
}
166+
}
167+
dependsOn(*ciBuildTasks.toTypedArray())
156168
named("koverHtmlReport").map { it.mustRunAfter(tasks.build) }
157169
named("dokkaHtmlMultiModule").map { it.mustRunAfter(tasks.build) }
158170
}

0 commit comments

Comments
 (0)