Skip to content

Commit 5710731

Browse files
authored
Publish CLI locally and use that version in the sbt-sourcegraph run (#559)
1 parent bf4ca0c commit 5710731

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

.github/workflows/sourcegraph.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,45 @@
11
name: Sourcegraph
22
on:
33
push:
4-
branches:
5-
- main
6-
4+
branches: ["main"]
5+
tags: ["v*"]
76
pull_request:
7+
branches: ["*"]
88

99
jobs:
1010
scip:
1111
runs-on: ubuntu-latest
1212
name: "Upload SCIP"
1313
steps:
1414
- uses: actions/checkout@v3
15+
with:
16+
fetch-depth: 0
17+
1518
- uses: actions/setup-java@v3
1619
with:
1720
distribution: 'temurin'
1821
java-version: 8
1922
cache: 'sbt'
2023

24+
- name: Publish CLI locally
25+
run: sbt publishLocal dumpScipJavaVersion
26+
27+
- name: Produce SCIP data of scip-java repository
28+
run: sbt -Dscip-java-version=$(cat VERSION) sourcegraphCompile
29+
30+
- name: Upload index.scip
31+
uses: actions/upload-artifact@master
32+
with:
33+
path: target/sbt-sourcegraph/index.scip
34+
name: index.scip
35+
if-no-files-found: error
36+
2137
- name: Install src
38+
if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main')
2239
run: yarn global add @sourcegraph/src
2340

24-
- name: sbt sourcegraphUpload
25-
run: sbt sourcegraphUpload
26-
41+
- name: Upload sourcegraph data
42+
if: startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main')
43+
run: sbt -Dscip-java-version=$(cat VERSION) sourcegraphUpload
2744
env:
2845
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,5 @@ bazel-scip-java
6161
bazel-out
6262
bazel-testlogs
6363
bazel-lsif-java
64+
65+
VERSION

build.sbt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,8 @@ lazy val bench = project
436436
lazy val docs = project
437437
.in(file("scip-java-docs"))
438438
.settings(
439+
publishLocal / skip := true,
440+
publish / skip := true,
439441
moduleName := "scip-java-docs",
440442
mdocOut :=
441443
(ThisBuild / baseDirectory).value / "website" / "target" / "docs",
@@ -525,3 +527,12 @@ lazy val fatjarPackageSettings = List[Def.Setting[_]](
525527
).transform(node).head
526528
}
527529
)
530+
531+
lazy val dumpScipJavaVersion = taskKey[Unit](
532+
"Dump the version of scip-java tool to a VERSION file"
533+
)
534+
dumpScipJavaVersion := {
535+
val versionValue = (cli / version).value
536+
537+
IO.write((ThisBuild / baseDirectory).value / "VERSION", versionValue)
538+
}

0 commit comments

Comments
 (0)