Skip to content

Commit

Permalink
fix: start releasing to Sonatype
Browse files Browse the repository at this point in the history
Since bintray is no longer an option, this sets up sbt-ci-release which
is commonly used for sbt plugins to do releases. I'll include some
comments inline.
  • Loading branch information
ckipp01 committed Oct 20, 2022
1 parent 38c6944 commit 470743f
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 42 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Release
on:
push:
branches:
- master
tags: ["*"]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '8'
- run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
29 changes: 5 additions & 24 deletions .github/workflows/sbt.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,29 @@
name: Scala CI

# Support "official releases" on master, and release fixes on release/ prefixed branches
on:
push:
branches:
- 'master'
- 'releases/**'
- '!releases/**-alpha'
paths-ignore:
- 'docs/**'
- 'README.md'
pull_request:
branches:
- 'master'
# trigger on new branch/tag creation
create: []

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin
- name: Cache SBT ivy cache
uses: actions/cache@v1
with:
path: ~/.ivy2/cache
key: ${{ runner.os }}-sbt-ivy-cache-${{ hashFiles('**/*.sbt') }}
- name: Cache SBT
uses: actions/cache@v1
with:
path: ~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}
cache: 'sbt'

- name: Run tests
run: sbt ^test ^scripted
- name: Publish
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_PASS: ${{ secrets.BINTRAY_PASS }}
run: sbt ^publish
run: sbt ^scripted
13 changes: 1 addition & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,16 @@ specifications as part of your build. Other tasks are available as command line
lazy val `sbt-openapi-generator` = (project in file("."))
.settings(
scalaVersion := "2.12.15",
crossScalaVersions := Seq(scalaVersion.value, "2.11.12"),
crossSbtVersions := List("0.13.17", "1.3.10"),
sbtPlugin := true,

publishMavenStyle := false,

bintrayRepository := "sbt-plugins",
bintrayOrganization := Option("openapitools"),
bintrayPackageLabels := Seq("sbt", "plugin", "oas", "openapi", "openapi-generator"),
bintrayVcsUrl := Some("git@github.com:OpenAPITools/sbt-openapi-generator.git"),

scriptedLaunchOpts := {
scriptedLaunchOpts.value ++ Seq("-Xmx1024M", "-server", "-Dplugin.version=" + version.value)
},

scriptedBufferLog := false,

resolvers ++= Seq(
Resolver.sbtPluginRepo("snapshots"),
Resolver.sonatypeRepo("snapshots")
),
resolvers ++= Resolver.sonatypeOssRepos("snapshots"),

homepage := Some(url("https://openapi-generator.tech")),

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.6.2
sbt.version=1.7.2
6 changes: 1 addition & 5 deletions project/plugin.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
// Manages publishing.
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6")

// Versions the build.
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")

0 comments on commit 470743f

Please sign in to comment.