Skip to content

Commit 0a682c1

Browse files
authored
ci: fix cli release process (#856)
- don't checkout, since we're building with coursier bootstrap - don't create a release if one doesn't exist
1 parent b778d3e commit 0a682c1

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/release-cli.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ permissions:
1313
jobs:
1414
publish:
1515
runs-on: ubuntu-latest
16+
env:
17+
OUT_DIR: ${{ runner.temp }}/release-cli
1618
steps:
17-
- uses: actions/checkout@v4
18-
with:
19-
fetch-depth: 0
20-
ref: refs/tags/${{ inputs.tag }}
21-
2219
- uses: actions/setup-java@v4
2320
with:
2421
distribution: 'temurin'
@@ -36,6 +33,9 @@ jobs:
3633
run: |
3734
set -euo pipefail
3835
36+
mkdir -p "$OUT_DIR"
37+
cd "$OUT_DIR"
38+
3939
VERSION=${VERSION#v}
4040
ARTIFACT="com.sourcegraph:scip-java_2.13:${VERSION}"
4141
@@ -66,28 +66,36 @@ jobs:
6666
mv scip-java.bat "scip-java-${TAG}.bat"
6767
shasum -a 256 "scip-java-${TAG}" "scip-java-${TAG}.bat" > "scip-java-${TAG}.sha256"
6868
69-
- name: Ensure GitHub release exists
69+
- name: Check for GitHub release
70+
id: release
7071
shell: bash
7172
env:
7273
GH_TOKEN: ${{ github.token }}
7374
TAG: ${{ inputs.tag }}
7475
run: |
7576
set -euo pipefail
7677
77-
if ! gh release view "$TAG" >/dev/null 2>&1; then
78-
gh release create "$TAG" --verify-tag --title "$TAG" --notes ""
78+
if gh release view "$TAG" --repo "sourcegraph/scip-java" >/dev/null 2>&1; then
79+
echo "exists=true" >> "$GITHUB_OUTPUT"
80+
else
81+
echo "exists=false" >> "$GITHUB_OUTPUT"
82+
echo "GitHub release $TAG does not exist in sourcegraph/scip-java; skipping asset upload."
7983
fi
8084
8185
- name: Upload release assets
86+
if: steps.release.outputs.exists == 'true'
8287
shell: bash
8388
env:
8489
GH_TOKEN: ${{ github.token }}
8590
TAG: ${{ inputs.tag }}
8691
run: |
8792
set -euo pipefail
8893
94+
cd "$OUT_DIR"
95+
8996
gh release upload "$TAG" \
9097
"scip-java-${TAG}" \
9198
"scip-java-${TAG}.bat" \
9299
"scip-java-${TAG}.sha256" \
100+
--repo "sourcegraph/scip-java"
93101
--clobber

0 commit comments

Comments
 (0)