Skip to content

Commit 12cda7d

Browse files
committed
Add ci-pipeline publishing for cogen
1 parent 6e79165 commit 12cda7d

3 files changed

Lines changed: 69 additions & 2 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Test code, update coverage, and release main branch
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
release:
7+
runs-on: ubuntu-latest
8+
needs: [ ]
9+
steps:
10+
- uses: actions/checkout@v4.2.2
11+
- name: Check if we are head of main
12+
id: check_head_of_main
13+
run: |
14+
git fetch origin main &&
15+
MAIN=`git rev-parse origin/main` &&
16+
echo "::set-output name=head_of_main::$MAIN" &&
17+
CURRENT=`git rev-list -n 1 ${{ github.ref }} || echo "NOT_MAIN"` &&
18+
echo "::set-output name=current_job_ref::$CURRENT"
19+
- name: Set up JDK
20+
if: steps.check_head_of_main.outputs.head_of_main == steps.check_head_of_main.outputs.current_job_ref
21+
uses: actions/setup-java@v4
22+
with:
23+
distribution: temurin
24+
java-version: 21
25+
- name: Set up SBT
26+
if: steps.check_head_of_master.outputs.head_of_main == steps.check_head_of_main.outputs.current_job_ref
27+
uses: sbt/setup-sbt@v1.10.11
28+
- name: Build and release
29+
if: steps.check_head_of_master.outputs.head_of_main == steps.check_head_of_main.outputs.current_job_ref
30+
env:
31+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
32+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
33+
SONA_USER: ${{ secrets.SONATYPE_USERNAME }}
34+
SONA_PASS: ${{ secrets.SONATYPE_PASSWORD }}
35+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
36+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
37+
PGP_KEY_HEX: ${{ secrets.PGP_KEY_HEX }}
38+
CI: github
39+
run: |
40+
git fetch --prune --unshallow --tags &&
41+
export GPG_TTY=$(tty) &&
42+
echo $PGP_SECRET | base64 -d | gpg --passphrase=$PGP_PASSPHRASE --yes --batch --pinentry-mode loopback --import &&
43+
export PATH=`pwd`/.github/bin:$PATH &&
44+
sbt cogen/ciReleaseTagNextVersion cogen/ciReleaseSonatype

build.sbt

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
import sbt.Keys._
2+
import sbt.Resolver
3+
import xerial.sbt.Sonatype.sonatypeCentralHost
4+
15
/** Settings shared globally. **/
26
lazy val commonSettings = Seq(
3-
version := "1.0.0-SNAPSHOT",
47
organization := "org.combinators",
58

69
scalaVersion := "3.7.4",
@@ -28,9 +31,27 @@ lazy val commonSettings = Seq(
2831
"org.typelevel" %% "cats-effect" % "3.6.1"
2932
),
3033
evictionErrorLevel := Level.Info,
34+
) ++ publishSettings
35+
36+
lazy val publishSettings = Seq(
37+
homepage := Some(url("https://combinators.org")),
38+
licenses := Seq("Apache 2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
39+
scmInfo := Some(ScmInfo(url("https://www.github.com/combinators/expression-problem"), "scm:git:git@github.com:combinators/expression-problem.git")),
40+
developers := List(
41+
Developer("JanBessai", "Jan Bessai", "jan.bessai@tu-dortmund.de", url("http://noprotocol.net")),
42+
Developer("heineman", "George T. Heineman", "heineman@wpi.edu", url("http://www.cs.wpi.edu/~heineman")),
43+
Developer("BorisDuedder", "Boris Düdder", "boris.d@di.ku.dk", url("http://duedder.net"))
44+
),
45+
publishTo := sonatypePublishToBundle.value,
46+
ThisBuild / sonatypeCredentialHost := sonatypeCentralHost,
47+
) ++ sys.env.get("PGP_KEY_HEX").map(h => usePgpKeyHex(h)).seq
48+
49+
lazy val noPublishSettings = Seq(
50+
publish := Seq.empty,
51+
publishLocal := Seq.empty,
52+
publishArtifact := false
3153
)
3254

33-
3455
/** The code generation infrastructure used in languages.
3556
* Things in here are (DI, LI, AI).
3657
*/

project/plugins.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
logLevel := Level.Warn
2+
addSbtPlugin("io.shiftleft" % "sbt-ci-release-early" % "2.1.9")

0 commit comments

Comments
 (0)