From 89f2d0f057bf6389a2099b83addf48551b0129ab Mon Sep 17 00:00:00 2001 From: Elie Gambache Date: Sun, 18 Oct 2026 00:31:11 +0300 Subject: [PATCH] Release: skip what a run again of the tag finds published Signed-off-by: Elie Gambache --- .github/workflows/release.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7f24d7..f0447a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,8 +24,15 @@ jobs: - uses: gradle/actions/setup-gradle@v5 + # A run again of a tag (a step after this one failed) skips what is already published - name: Publish the runtimes to Maven Central - run: ./gradlew --project-dir runtime publishAndReleaseToMavenCentral --no-configuration-cache + run: | + version="${GITHUB_REF_NAME#v}" + if curl -sfI "https://repo1.maven.org/maven2/dev/nucleusframework/nja/nja-client/$version/nja-client-$version.pom" > /dev/null; then + echo "nja-server and nja-client $version are on Maven Central already" + else + ./gradlew --project-dir runtime publishAndReleaseToMavenCentral --no-configuration-cache + fi env: ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVENCENTRALUSERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVENCENTRALPASSWORD }} @@ -42,4 +49,4 @@ jobs: - name: GitHub release env: GH_TOKEN: ${{ github.token }} - run: gh release create "${{ github.ref_name }}" --generate-notes --title "${{ github.ref_name }}" + run: gh release view "${{ github.ref_name }}" > /dev/null 2>&1 || gh release create "${{ github.ref_name }}" --generate-notes --title "${{ github.ref_name }}"