Skip to content

Commit 5215d25

Browse files
committed
updated CD to allow releasing specified versions
1 parent d9405e2 commit 5215d25

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: Release
22

3-
on: workflow_dispatch
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_version:
7+
description: Release version
8+
required: false
9+
default: ''
410

511
jobs:
612
pre-release:
@@ -21,8 +27,12 @@ jobs:
2127
run: >-
2228
git config user.name "${{ secrets.GIT_USERNAME }}" &&
2329
git config user.email "${{ secrets.GIT_USER_EMAIL }}"
30+
- name: Release the specified version
31+
if: ${{ github.event.inputs.release_version != '' }}
32+
run: sbt preRelease ${{ github.event.inputs.release_version }}
2433
- name: Release new version
25-
run: sbt preRelease
34+
if: ${{ github.event.inputs.release_version == '' }}
35+
run: sbt preRelease ""
2636
- name: Latest tag
2737
uses: actions-ecosystem/action-get-latest-tag@v1
2838
id: latest-tag

.scalafmt.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ rewrite.scala3.convertToNewSyntax = yes
55
rewrite.scala3.insertEndMarkerMinLines = 4
66
rewrite.scala3.removeOptionalBraces = oldSyntaxToo
77
project.git = true
8+
9+
fileOverride {
10+
"glob:**.sbt" {
11+
runner.dialect = sbt1
12+
}
13+
}

build.sbt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ scalacOptions ++= Seq(
5757
"-Wunused:all"
5858
)
5959

60-
commands += Command.command("preRelease") { state =>
60+
commands += Command.single("preRelease") { (state, nextVersion) =>
6161
val newState = Project
6262
.extract(state)
6363
.appendWithSession(
@@ -77,7 +77,14 @@ commands += Command.command("preRelease") { state =>
7777
state,
7878
)
7979

80-
Command.process("release with-defaults", newState)
80+
if (nextVersion == "\"\"")
81+
Command.process("release with-defaults", newState)
82+
else
83+
Command.process(
84+
s"release with-defaults release-version $nextVersion",
85+
newState,
86+
)
87+
8188
}
8289

8390
commands += Command.command("postRelease") { state =>

0 commit comments

Comments
 (0)