mirror of
https://github.com/fluencelabs/aqua.git
synced 2024-12-04 22:50:18 +00:00
Pass sbt version to JAR file (#55)
This commit is contained in:
parent
970da2e1b7
commit
6ec999c5b6
35
.github/workflows/release.yml
vendored
35
.github/workflows/release.yml
vendored
@ -25,27 +25,44 @@ jobs:
|
||||
### Update & build
|
||||
- name: Assembly
|
||||
run: sbt cli/assembly
|
||||
env:
|
||||
BUILD_NUMBER: ${{ github.run_number }}
|
||||
|
||||
### Create release
|
||||
- name: Get project version
|
||||
# In CI sbt appends a new line after its output, so we need `tail -n2 | head -n1`
|
||||
# In CI sbt appends a new line after its output, so we need `tail -n3 | head -n2` to get last two non-empty lines
|
||||
run: |
|
||||
VERSION="$(sbt 'print cli/version' |& tail -n2 | head -n1)"
|
||||
echo "SBT_VERSION=$VERSION" >> $GITHUB_ENV
|
||||
echo "VERSION=$VERSION-${{ github.run_number }}" >> $GITHUB_ENV
|
||||
# Slower way of getting two variables from sbt. Try it if something breaks
|
||||
#
|
||||
# VERSION="$(sbt 'print cli/version' |& tail -n2 | head -n1)"
|
||||
# BASE_VERSION="$(sbt 'print cli/baseAquaVersion' |& tail -n2 | head -n1)"
|
||||
|
||||
- name: Add version to .jar name
|
||||
# print two versions as two lines
|
||||
OUTPUT=$(sbt 'print cli/baseAquaVersion; print cli/version')
|
||||
# read two lines to two variables
|
||||
read -rd "\n" BASE_VERSION VERSION <<<$(echo "$OUTPUT" | tail -n3 | head -n2) || true
|
||||
|
||||
# debug output
|
||||
echo "BASE_VERSION="$BASE_VERSION
|
||||
echo "VERSION="$VERSION
|
||||
|
||||
echo "BASE_VERSION=$BASE_VERSION" >> $GITHUB_ENV
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
env:
|
||||
BUILD_NUMBER: ${{ github.run_number }}
|
||||
|
||||
- name: Check .jar exists
|
||||
run: |
|
||||
JAR="aqua-hll-${{ env.VERSION }}.jar"
|
||||
mv "cli/target/scala-2.13/aqua-hll.jar" $JAR
|
||||
JAR="cli/target/scala-2.13/aqua-cli-${{ env.VERSION }}.jar"
|
||||
stat "$JAR"
|
||||
echo "JAR=$JAR" >> $GITHUB_ENV
|
||||
|
||||
- uses: marvinpinto/action-automatic-releases@latest
|
||||
with:
|
||||
# changelog will be automatically generated from the history
|
||||
# between tag env.SBT_VERSION (eg 0.1.0 or 0.2.0, etc)
|
||||
# between tag env.BASE_VERSION (eg 0.1.0 or 0.2.0, etc)
|
||||
# and the current commit
|
||||
automatic_release_tag: "${{ env.SBT_VERSION }}"
|
||||
automatic_release_tag: "${{ env.BASE_VERSION }}"
|
||||
title: "Aqua Compiler ${{ env.VERSION }}"
|
||||
files: |
|
||||
${{ env.JAR }}
|
||||
|
@ -4,7 +4,7 @@ scalaVersion := dottyVersion
|
||||
|
||||
//val dottyVersion = "3.0.0-RC2"
|
||||
|
||||
val aquaV = "0.1.1"
|
||||
val baseAquaVersion = settingKey[String]("base aqua version")
|
||||
|
||||
val catsV = "2.5.0"
|
||||
val catsParseV = "0.3.2"
|
||||
@ -17,7 +17,8 @@ val declineV = "2.0.0-RC1"
|
||||
name := "aqua-hll"
|
||||
|
||||
val commons = Seq(
|
||||
version := aquaV,
|
||||
baseAquaVersion := "0.1.1",
|
||||
version := baseAquaVersion.value + "-" + sys.env.getOrElse("BUILD_NUMBER", "SNAPSHOT"),
|
||||
scalaVersion := dottyVersion,
|
||||
libraryDependencies += "org.scalatest" %% "scalatest" % scalaTestV % Test,
|
||||
addCompilerPlugin("org.typelevel" %% "kind-projector" % "0.11.3" cross CrossVersion.full)
|
||||
@ -30,7 +31,7 @@ lazy val cli = project
|
||||
.settings(
|
||||
mainClass in (Compile, run) := Some("aqua.AquaCli"),
|
||||
mainClass in assembly := Some("aqua.AquaCli"),
|
||||
assemblyJarName in assembly := "aqua-hll.jar",
|
||||
assemblyJarName in assembly := "aqua-cli-" + version.value + ".jar",
|
||||
libraryDependencies ++= Seq(
|
||||
"com.monovore" %% "decline" % declineV,
|
||||
"com.monovore" %% "decline-effect" % declineV,
|
||||
|
@ -52,7 +52,6 @@ object AquaCli extends IOApp {
|
||||
"aqua-c",
|
||||
"Aquamarine compiler",
|
||||
helpFlag = true,
|
||||
// TODO get version from SBT!
|
||||
Option("0.1.1").filter(_.nonEmpty)
|
||||
Option(getClass.getPackage.getImplementationVersion).filter(_.nonEmpty)
|
||||
)(mainOpts, args)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user