From 23114a0338574bd38c806077988691143a3b2788 Mon Sep 17 00:00:00 2001 From: Travis Lyons Date: Wed, 1 Apr 2026 17:07:43 -0400 Subject: [PATCH] ci: fix cli release process - don't checkout, since we're building with coursier bootstrap - don't create a release if one doesn't exist --- .github/workflows/release-cli.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-cli.yml b/.github/workflows/release-cli.yml index 24c89852..df686081 100644 --- a/.github/workflows/release-cli.yml +++ b/.github/workflows/release-cli.yml @@ -13,12 +13,9 @@ permissions: jobs: publish: runs-on: ubuntu-latest + env: + OUT_DIR: ${{ runner.temp }}/release-cli steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: refs/tags/${{ inputs.tag }} - - uses: actions/setup-java@v4 with: distribution: 'temurin' @@ -36,6 +33,9 @@ jobs: run: | set -euo pipefail + mkdir -p "$OUT_DIR" + cd "$OUT_DIR" + VERSION=${VERSION#v} ARTIFACT="com.sourcegraph:scip-java_2.13:${VERSION}" @@ -66,7 +66,8 @@ jobs: mv scip-java.bat "scip-java-${TAG}.bat" shasum -a 256 "scip-java-${TAG}" "scip-java-${TAG}.bat" > "scip-java-${TAG}.sha256" - - name: Ensure GitHub release exists + - name: Check for GitHub release + id: release shell: bash env: GH_TOKEN: ${{ github.token }} @@ -74,11 +75,15 @@ jobs: run: | set -euo pipefail - if ! gh release view "$TAG" >/dev/null 2>&1; then - gh release create "$TAG" --verify-tag --title "$TAG" --notes "" + if gh release view "$TAG" --repo "sourcegraph/scip-java" >/dev/null 2>&1; then + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "exists=false" >> "$GITHUB_OUTPUT" + echo "GitHub release $TAG does not exist in sourcegraph/scip-java; skipping asset upload." fi - name: Upload release assets + if: steps.release.outputs.exists == 'true' shell: bash env: GH_TOKEN: ${{ github.token }} @@ -86,8 +91,11 @@ jobs: run: | set -euo pipefail + cd "$OUT_DIR" + gh release upload "$TAG" \ "scip-java-${TAG}" \ "scip-java-${TAG}.bat" \ "scip-java-${TAG}.sha256" \ + --repo "sourcegraph/scip-java" --clobber