Created
August 8, 2023 09:50
-
-
Save vic/5ab3b74b18a7a4853e836e8234ff1438 to your computer and use it in GitHub Desktop.
scala-cli gh-actions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
before_install: | |
- curl -o scala-cli https://raw.githubusercontent.com/VirtusLab/scala-cli/main/scala-cli.sh | |
- chmod +x scala-cli | |
install: | |
- | | |
./scala-cli --power publish --publish-repository $HOME/.m2/repository --organization "$GROUP" --name "$ARTIFACT" --version "$VERSION" . | |
ls -R $HOME/.m2/repository/ | |
find $HOME/.m2/repository -type f -name "*.pom" -exec cp -v {} $PWD \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- scala -*- | |
//> using dep "com.lihaoyi::os-lib:0.9.1" | |
//> using resourceDir ./ | |
object Main extends App { | |
val classLoader = getClass().getClassLoader() | |
val workflowSrc = classLoader.getResourceAsStream("workflow.yml") | |
val jitpackSrc = classLoader.getResourceAsStream("jitpack.yml") | |
val workflowYml = os.pwd / ".github" / "workflows" / "scala-cli.yml" | |
val jitpackYml = os.pwd / "jitpack.yml" | |
os.makeDir.all(workflowYml / os.up) | |
os.write(workflowYml, workflowSrc) | |
os.write(jitpackYml, jitpackSrc) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
jobs: | |
test: | |
needs: format | |
runs-on: ${{ matrix.OS }} | |
strategy: | |
matrix: | |
OS: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: coursier/cache-action@v6 | |
- uses: VirtusLab/scala-cli-setup@v1 | |
- run: scala-cli --power test . | |
format: | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: coursier/cache-action@v6 | |
- uses: VirtusLab/scala-cli-setup@v1 | |
- name: Scalafmt check | |
run: | | |
scala-cli --power fmt --check . || ( | |
echo "To format code run" | |
echo " scala-cli fmt ." | |
exit 1 | |
) | |
jitpack-commit: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: JitPack commit build | |
run: | | |
set -x | |
curl -sSL https://jitpack.io/com/github/$GITHUB_REPOSITORY/$GITHUB_SHA/build.log || true | |
jitpack-release: | |
needs: test | |
runs-on: ubuntu-latest | |
if: contains(github.ref, 'tags') | |
steps: | |
- name: JitPack release build | |
run: | | |
set -x | |
curl -sSL https://jitpack.io/com/github/$GITHUB_REPOSITORY/$(echo "${{github.ref}}" | sed 's#tags/v\?##')/build.log || true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment