Skip to content

Commit

Permalink
Add missing ref env and tweak check ref task.
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdAurora committed Dec 23, 2023
1 parent 37fee7a commit 5c59b45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
arguments: build check --stacktrace --parallel
env:
ACTIONS_REF: ${{ github.ref }}
- uses: actions/upload-artifact@v3
with:
name: Artifacts
Expand All @@ -30,6 +32,7 @@ jobs:
with:
arguments: publish publishToSonatype closeSonatypeStagingRepository --stacktrace
env:
ACTIONS_REF: ${{ github.ref }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.MAVEN_CENTRAL_PUBLISH_KEY }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.MAVEN_CENTRAL_PUBLISH_SECRET }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_PGP_KEY_ID }}
Expand Down
4 changes: 2 additions & 2 deletions build_logic/src/main/kotlin/task/CheckActionsRefTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ open class CheckActionsRefTask : DefaultTask() {

@TaskAction
fun execute() {
val refName = System.getenv("ACTIONS_REF_NAME") ?: throw GradleException("Could not find GitHub Actions ref name.")
val refName = System.getenv("ACTIONS_REF")

if (refName != "v${Constants.VERSION}") {
if (refName != null && refName != "refs/tags/v${Constants.VERSION}") {
throw GradleException("Failed to validate ref name.")
}
}
Expand Down

0 comments on commit 5c59b45

Please sign in to comment.