-
Notifications
You must be signed in to change notification settings - Fork 42
101 lines (84 loc) · 2.54 KB
/
release-cli.yml
File metadata and controls
101 lines (84 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Release CLI
on:
workflow_call:
inputs:
tag:
description: Git tag to release assets for.
required: true
type: string
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
env:
OUT_DIR: ${{ runner.temp }}/release-cli
steps:
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 8
- uses: coursier/setup-action@v3
with:
apps: ''
- name: Build standalone launcher
shell: bash
env:
TAG: ${{ inputs.tag }}
VERSION: ${{ inputs.tag }}
run: |
set -euo pipefail
mkdir -p "$OUT_DIR"
cd "$OUT_DIR"
VERSION=${VERSION#v}
ARTIFACT="com.sourcegraph:scip-java_2.13:${VERSION}"
for attempt in {1..10}; do
if cs resolve "$ARTIFACT" >/dev/null 2>&1; then
break
fi
if [ "$attempt" -eq 10 ]; then
echo "Artifact $ARTIFACT was not resolvable after 10 attempts" >&2
exit 1
fi
sleep 30
done
cs bootstrap \
--standalone \
--bat=true \
-o scip-java \
"$ARTIFACT" \
--main com.sourcegraph.scip_java.ScipJava
chmod +x scip-java
./scip-java --help >/dev/null
mv scip-java "scip-java-${TAG}"
mv scip-java.bat "scip-java-${TAG}.bat"
shasum -a 256 "scip-java-${TAG}" "scip-java-${TAG}.bat" > "scip-java-${TAG}.sha256"
- name: Check for GitHub release
id: release
shell: bash
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag }}
run: |
set -euo pipefail
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 }}
TAG: ${{ inputs.tag }}
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