Skip to main content
Version: 2.5.0

DevOopsGitHubReleasePlugin Examples

With GitHub Actions

PROJECT_ROOT/project/plugins.sbt

addSbtPlugin("io.kevinlee" % "sbt-devoops" % "2.5.0")

A Single Project

A single project in the root.

build.sbt

PROJECT_ROOT/build.sbt

ThisBuild / organization := "com.example"
ThisBuild / scalaVersion := "2.13.3"
ThisBuild / version := "0.1.0"

lazy val root = (project in file("."))
.enablePlugins(DevOopsGitHubReleasePlugin)
.settings(
name := "test-project",
libraryDependencies += "some" %% "lib" % "1.0.0"
)

Make sure you have changelog in the PROJECT_ROOT/changelogs folder.

e.g.) If the project version in build.sbt is 0.1.0,

PROJECT_ROOT/changelogs/0.1.0.md

GitHub Actions Config

Before setting up GitHub Actions, make sure you have a GitHub personal access token with at least the publis_repo scope.

  • public_repo Access public repositories Person Access Token Scope

and add the access token to the project's Secrets.

e.g.)

To release whenever tag is created and pushed to the remote repo, add the GitHub Actions config yaml file like the following one to PROJECT_ROOT/.github/workflows.

e.g. release.yml

name: Release

on:
push:
tags:
- '*'

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
scala:
- { version: "2.13.3", binary-version: "2.13", java-version: "11" }

steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: ${{ matrix.scala.java-version }}

- name: Cache SBT
uses: actions/cache@v2
with:
path: |
~/.ivy2/cache
~/.cache/coursier
~/.sbt
key: ${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('**/build.properties') }}
restore-keys: |
${{ runner.os }}-sbt-${{ matrix.scala.binary-version }}-

- name: sbt GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
run: |
echo "Run] sbt GitHub release"
echo 'sbt -J-Xmx2048m ++${{ matrix.scala.version }}! clean test packagedArtifacts'
sbt -J-Xmx2048m \
++${{ matrix.scala.version }}! \
clean \
test \
packagedArtifacts \
devOopsGitHubRelease \
devOopsGitHubReleaseUploadArtifacts

If you want to manually run it, you need run at least the following three tasks.

sbt packagedArtifacts devOopsGitHubRelease devOopsGitHubReleaseUploadArtifacts

A Project with Multiple Sub-projects

NOTE:

To be added...