Skip to content

Commit b778d3e

Browse files
authored
cli: build and release cli executibles (#855)
- Adds a new workflow to build, checksum, and upload standalone scip-java launchers for Linux and Windows - Integrates CLI release generation into the existing Maven publishing pipeline upon tag creation
1 parent 06d62f2 commit b778d3e

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed

.github/workflows/release-cli.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Release CLI
2+
on:
3+
workflow_call:
4+
inputs:
5+
tag:
6+
description: Git tag to release assets for.
7+
required: true
8+
type: string
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
ref: refs/tags/${{ inputs.tag }}
21+
22+
- uses: actions/setup-java@v4
23+
with:
24+
distribution: 'temurin'
25+
java-version: 8
26+
27+
- uses: coursier/setup-action@v3
28+
with:
29+
apps: ''
30+
31+
- name: Build standalone launcher
32+
shell: bash
33+
env:
34+
TAG: ${{ inputs.tag }}
35+
VERSION: ${{ inputs.tag }}
36+
run: |
37+
set -euo pipefail
38+
39+
VERSION=${VERSION#v}
40+
ARTIFACT="com.sourcegraph:scip-java_2.13:${VERSION}"
41+
42+
for attempt in {1..10}; do
43+
if cs resolve "$ARTIFACT" >/dev/null 2>&1; then
44+
break
45+
fi
46+
47+
if [ "$attempt" -eq 10 ]; then
48+
echo "Artifact $ARTIFACT was not resolvable after 10 attempts" >&2
49+
exit 1
50+
fi
51+
52+
sleep 30
53+
done
54+
55+
cs bootstrap \
56+
--standalone \
57+
--bat=true \
58+
-o scip-java \
59+
"$ARTIFACT" \
60+
--main com.sourcegraph.scip_java.ScipJava
61+
62+
chmod +x scip-java
63+
./scip-java --help >/dev/null
64+
65+
mv scip-java "scip-java-${TAG}"
66+
mv scip-java.bat "scip-java-${TAG}.bat"
67+
shasum -a 256 "scip-java-${TAG}" "scip-java-${TAG}.bat" > "scip-java-${TAG}.sha256"
68+
69+
- name: Ensure GitHub release exists
70+
shell: bash
71+
env:
72+
GH_TOKEN: ${{ github.token }}
73+
TAG: ${{ inputs.tag }}
74+
run: |
75+
set -euo pipefail
76+
77+
if ! gh release view "$TAG" >/dev/null 2>&1; then
78+
gh release create "$TAG" --verify-tag --title "$TAG" --notes ""
79+
fi
80+
81+
- name: Upload release assets
82+
shell: bash
83+
env:
84+
GH_TOKEN: ${{ github.token }}
85+
TAG: ${{ inputs.tag }}
86+
run: |
87+
set -euo pipefail
88+
89+
gh release upload "$TAG" \
90+
"scip-java-${TAG}" \
91+
"scip-java-${TAG}.bat" \
92+
"scip-java-${TAG}.sha256" \
93+
--clobber

.github/workflows/release-maven.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches: [main]
55
tags: ["*"]
6+
67
jobs:
78
publish:
89
runs-on: ubuntu-latest
@@ -23,3 +24,12 @@ jobs:
2324
PGP_SECRET: ${{ secrets.PGP_SECRET }}
2425
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
2526
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
27+
28+
release-cli:
29+
if: ${{ startsWith(github.ref, 'refs/tags/') }}
30+
needs: publish
31+
permissions:
32+
contents: write
33+
uses: ./.github/workflows/release-cli.yml
34+
with:
35+
tag: ${{ github.ref_name }}

0 commit comments

Comments
 (0)