From 470743f99def53490c06888b6c4fe0b920a51999 Mon Sep 17 00:00:00 2001 From: Chris Kipp Date: Wed, 31 Aug 2022 12:05:37 +0200 Subject: [PATCH] fix: start releasing to Sonatype 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. --- .github/workflows/release.yml | 23 +++++++++++++++++++++++ .github/workflows/sbt.yml | 29 +++++------------------------ build.sbt | 13 +------------ project/build.properties | 2 +- project/plugin.sbt | 6 +----- 5 files changed, 31 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9329ff6 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/.github/workflows/sbt.yml b/.github/workflows/sbt.yml index 81ed18d..99891d0 100644 --- a/.github/workflows/sbt.yml +++ b/.github/workflows/sbt.yml @@ -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 diff --git a/build.sbt b/build.sbt index 670c12c..b220ec3 100644 --- a/build.sbt +++ b/build.sbt @@ -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")), diff --git a/project/build.properties b/project/build.properties index c8fcab5..563a014 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.6.2 +sbt.version=1.7.2 diff --git a/project/plugin.sbt b/project/plugin.sbt index a13d930..ae3b908 100644 --- a/project/plugin.sbt +++ b/project/plugin.sbt @@ -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")