-
Notifications
You must be signed in to change notification settings - Fork 6
91 lines (87 loc) · 3.35 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: CI
env:
JAVA_OPTS: "-Dfile.encoding=UTF-8 -Xms1024M -Xmx3072M -Xss4M -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler"
on:
push:
branches: '*'
tags: [ "v[0-9]+*" ]
pull_request:
# avoid duplicate checks (push & PR) further in the review process
types: [opened]
jobs:
test:
name: Run tests
runs-on: ubuntu-20.04 # https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
strategy:
fail-fast: false
matrix:
scala: [ 2.12.14, 2.13.6 ]
command: [ test ]
steps:
- uses: actions/checkout@v2
- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache
~/.cache/coursier
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}-${{ hashFiles('project/Dependencies.scala') }}
restore-keys: ${{ runner.os }}-sbt-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache npm
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- name: Set up node
uses: actions/setup-node@v2-beta
- name: Run tests
run: sbt "set concurrentRestrictions in Global += Tags.limit(ScalaJSTags.Link, 1)" ++${{ matrix.scala }} ${{ matrix.command }}
publish:
name: Publish to Sonatype
# only run on tag push
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v'))
needs: [ test ]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache
~/.cache/coursier
key: ${{ runner.os }}-sbt-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}-${{ hashFiles('project/Dependencies.scala') }}
restore-keys: ${{ runner.os }}-sbt-
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Get version
id: get_tag_name
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
- name: Import GPG key
env:
#exported via `gpg -a --export-secret-keys <key> | cat -e | sed 's/\$/\\n/g' | xclip -selection clipboard` and added to org secrets
SONATYPE_GPG: ${{ secrets.SONATYPE_GPG }}
run: echo -e $SONATYPE_GPG | gpg --import -
- name: Publish artifacts
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: sbt 'set version in ThisBuild := "${{ steps.get_tag_name.outputs.VERSION }}"' +publishSigned
- name: Release Sonatype bundle
#https://github.com/xerial/sbt-sonatype#publishing-your-artifact
if: ${{ !endsWith(steps.get_tag_name.outputs.VERSION, 'SNAPSHOT') }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
run: sbt 'set version in ThisBuild := "${{ steps.get_tag_name.outputs.VERSION }}"' sonatypeBundleRelease