Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .github/workflows/publish-release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# TODO: Consider whether we should merge this with the "prepare-release" workflow rather
# than having separate workflows.

name: Publish Artifacts for Release
name: "Publish Release Artifacts"

on:
release:
Expand All @@ -42,10 +42,19 @@ jobs:
echo "Project Version: $PROJECT_VERSION"
echo "Release Tag: $RELEASE_TAG"
[ "$PROJECT_VERSION" = "$RELEASE_TAG" ] || exit 1
- uses: gradle/gradle-build-action@e2097ccd7e8ed48671dc068ac4efa86d25745b39 # v3.3.1
- name: Build Release Artifacts
uses: gradle/gradle-build-action@e2097ccd7e8ed48671dc068ac4efa86d25745b39 # v3.3.1
with:
arguments: build cyclonedxBom publishToSonatype closeAndReleaseSonatypeStagingRepository
- name: Upload Jar to GitHub release
arguments: build cyclonedxBom
- name: Publish to Sonatype
uses: gradle/gradle-build-action@e2097ccd7e8ed48671dc068ac4efa86d25745b39 # v3.3.1
with:
arguments: publishToSonatype
- name: Close and Release Sonatype Staging Repository
uses: gradle/gradle-build-action@e2097ccd7e8ed48671dc068ac4efa86d25745b39 # v3.3.1
with:
arguments: closeAndReleaseSonatypeStagingRepository
- name: Upload Artifacts to GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# TODO - reusability
Expand Down
9 changes: 9 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ description = "A Java implementation of the Amazon Ion data notation."
val isCI: Boolean = System.getenv("CI") == "true"
val githubRepositoryUrl = "https://github.com/amazon-ion/ion-java/"
val isReleaseVersion: Boolean = !version.toString().endsWith("SNAPSHOT")
// The name we're checking for corresponds to the name that is set in the `publish-release-artifacts.yml` file.
val isReleaseWorkflow: Boolean = System.getenv("GITHUB_WORKFLOW") == "Publish Release Artifacts"
val generatedResourcesDir = "$buildDir/generated/main/resources"
lateinit var sourcesJar: AbstractArchiveTask
lateinit var javadocJar: AbstractArchiveTask
Expand Down Expand Up @@ -150,6 +152,13 @@ fun String.runCommand(workingDir: File = rootProject.projectDir): String {
}

spotless {
// If this is an automated release workflow, don't configure any style checks.
// This is important because we're ratcheting from `master` and when we create
// a release that is not directly from `master`, the spotless checks can cause
// the release workflow to fail if `master` has any commits that are not in the
// release branch.
if (isReleaseWorkflow) return@spotless

ratchetFrom("$sourceRepoRemoteName/master")

val shortFormLicenseHeader = """
Expand Down