Skip to content
This repository has been archived by the owner on Sep 25, 2020. It is now read-only.
/ sbt-coursier-cache Public archive

One-liner sbt & coursier cache for GH actions

License

Notifications You must be signed in to change notification settings

gvolpe/sbt-coursier-cache

Repository files navigation

sbt-coursier-cache

ARCHIVED: Use the official Coursier cache action instead.


one-liner sbt and coursier cache for GitHub Actions

Add this step before running any sbt command:

- uses: gvolpe/[email protected]

For example:

name: CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
    - uses: actions/checkout@v1

    - uses: gvolpe/[email protected]

    - name: Build Scala project
      run: nix-shell --run "sbt compile"

Native solution

This one-liner action is the equivalent to doing the following:

- run: |
    shasum build.sbt \
      project/plugins.sbt \
      project/build.properties \
      project/Dependencies.scala > gha.cache.tmp

- name: "~/.sbt cache"
  uses: "actions/cache@v1"
  with:
    key: "${{ runner.os }}-sbt-${{ hashFiles('gha.cache.tmp') }}"
    path: "~/.sbt"
    restore-keys: sbt

- name: "~/.cache/coursier cache"
  uses: "actions/cache@v1"
  with:
    key: "${{ runner.os }}-coursier-${{ hashFiles('gha.cache.tmp') }}"
    path: "~/.cache/coursier"
    restore-keys: coursier

Credits

This action has been inspired by gha-yarn-cache.

License

The project is available as open source under the terms of the MIT License.