Skip to content

Commit

Permalink
Merge pull request #51 from mkurz/sbt-ci-release
Browse files Browse the repository at this point in the history
Introduce sbt-ci-release to support release by tag
  • Loading branch information
mkurz authored Nov 28, 2023
2 parents 9be6fdf + 61b45ba commit 41c4a3c
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 6 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish

on:
push:
branches: # Snapshots
- main
tags: ["**"] # Releases
release:
types: [published]

jobs:
publish-artifacts:
name: JDK 11
runs-on: ubuntu-20.04
if: ${{ github.repository_owner == 'jamesward' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Coursier Cache
id: coursier-cache
uses: coursier/cache-action@v6

- name: Install Adoptium Temurin OpenJDK
uses: coursier/setup-action@v1
with:
jvm: adoptium:11

- name: Publish artifacts
run: sbt ci-release
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}

- name: Cleanup before cache
shell: bash
run: |
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
24 changes: 19 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,28 @@ javacOptions ++= Seq("--release", "11")

description := "Auto refresh for Play Framework apps"

publishMavenStyle := false
homepage := Some(url("https://github.com/jamesward/play-auto-refresh"))

libraryDependencies += "ws.unfiltered" %% "unfiltered-netty-websockets" % "0.12.0"

licenses += "MIT" -> url("http://opensource.org/licenses/MIT")

enablePlugins(GitVersioning)

git.useGitDescribe := true

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.9.0" % Provided)

// Customise sbt-dynver's behaviour to make it work with tags which are/aren't v-prefixed
ThisBuild / dynverVTagPrefix := true

// Sanity-check: assert that version comes from a tag (e.g. not a too-shallow clone)
// https://github.com/dwijnand/sbt-dynver/#sanity-checking-the-version
Global / onLoad := (Global / onLoad).value.andThen { s =>
dynverAssertTagVersion.value
s
}

developers ++= List(Developer(
"jamesward",
"James Ward",
"[email protected]",
url("https://github.com/jamesward")
),
)
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.github.sbt" % "sbt-git" % "2.0.1")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")

0 comments on commit 41c4a3c

Please sign in to comment.