Skip to content

Install sbt in github actions #65

Install sbt in github actions

Install sbt in github actions #65

Workflow file for this run

name: CI
on:
push:
tags:
- '*'
branches:
- master
- develop
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: coursier/cache-action@v6
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Install sbt
uses: sbt/setup-sbt@v1
- name: Run tests
run: sbt +test
- name: Check Scala formatting
if: ${{ always() }}
run: sbt scalafmtCheckAll
- name: Check assets can be published
if: ${{ always() }}
run: sbt +publishLocal
- name: Check binary compatibility
if: ${{ always() }}
run: sbt +mimaReportBinaryIssues
- name: Deploy to Maven Central
if: startsWith(github.ref, 'refs/tags/')
run: sbt ci-release
env:
PGP_PASSPHRASE: ${{ secrets.SONA_PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.SONA_PGP_SECRET }}
SONATYPE_USERNAME: ${{ secrets.SONA_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONA_PASS }}
- name: Publish ScalaDoc
if: startsWith(github.ref, 'refs/tags/')
run: |
project_version=$(sbt version -Dsbt.log.noformat=true | perl -ne 'print "$1\n" if /info.*(\d+\.\d+\.\d+[^\r\n]*)/' | tail -n 1 | tr -d '\n')
if [[ "${{ github.ref }}" = "refs/tags/${project_version}" ]]
then
sbt "project docs" makeSite
echo Publishing Scaladoc
git fetch
git checkout gh-pages
cp -r docs/target/site/* .
git config user.name "GitHub Actions"
git config user.email "<>"
git add $project_version
git commit -m "Added Scaladoc for $project_version"
git push origin gh-pages
else
echo "${{ github.ref }} does not match project version $project_version => not publishing"
exit 1
fi