Skip to content

Commit aa7f305

Browse files
committed
Automating Release Pipelines
1 parent 08ac04b commit aa7f305

File tree

3 files changed

+52
-41
lines changed

3 files changed

+52
-41
lines changed

.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Cross Release After Testing
2+
3+
on:
4+
create:
5+
branches:
6+
- 'refs/tags/*'
7+
8+
jobs:
9+
test-and-release:
10+
11+
runs-on: ubuntu-latest
12+
13+
env:
14+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE}}
15+
GPG_KEYS: ${{ secrets.GPG_KEYS}}
16+
SONATYPE_SBT: ${{ secrets.SONATYPE_SBT }}
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Setup JDK 11
21+
uses: actions/setup-java@v1
22+
with:
23+
java-version: 11
24+
- name: Setup GPG Keys
25+
run: |
26+
echo $GPG_KEYS | base64 -di > keys.zip
27+
unzip -d project/.gnupg keys.zip
28+
mkdir -p ~/.sbt/1.0
29+
echo $SONATYPE_SBT > ~/.sbt/1.0/sonatype.sbt
30+
- name: Setup version in SBT
31+
run: |
32+
VERSION=${GITHUB_REF/refs\/tags\//}
33+
echo $VERSION
34+
sed "s/unstable-SNAPSHOT/${VERSION}/" build.sbt > build.sbt.2
35+
mv build.sbt.2 build.sbt
36+
- name: Test & Release
37+
run: |
38+
VERSION=${GITHUB_REF/refs\/tags\//}
39+
if [[ $VERSION =~ \-SNAPSHOT$ ]]; then
40+
sbt test +publishSigned
41+
else
42+
sbt test +publishSigned sonatypeRelease
43+
fi
44+

.gitlab-ci.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

build.sbt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ScalaOptions._
33

44
organization in ThisBuild := "com.enfore"
55
ThisBuild / crossScalaVersions := supportedVersions
6-
version in ThisBuild := "1.3.5"
6+
version in ThisBuild := "unstable-SNAPSHOT"
77
fork in Test in ThisBuild := true
88

99
lazy val http4s = Seq(http4sCore, http4sDsl, http4sCirce, http4sServer)
@@ -86,9 +86,13 @@ lazy val `sbt-openapi` = (project in file("sbt-openapi"))
8686
lazy val publishSettings = Seq(
8787
crossPaths := true,
8888
autoAPIMappings := true,
89-
publishTo := Some(
90-
Opts.resolver.sonatypeSnapshots
91-
),
89+
publishTo := {
90+
if (isSnapshot.value)
91+
Some(
92+
Opts.resolver.sonatypeSnapshots
93+
)
94+
else Some(Opts.resolver.sonatypeStaging)
95+
},
9296
useGpg := false,
9397
usePgpKeyHex("1EAA6358E4812E9E"),
9498
pgpPublicRing := file(".") / "project" / ".gnupg" / "pubring.gpg",

0 commit comments

Comments
 (0)