-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (88 loc) · 3.72 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
92
93
94
95
96
97
98
99
name: CI
on:
push:
paths-ignore:
- '*.md'
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git checkout (merge)
uses: actions/checkout@v3
if: github.event_name != 'pull_request'
with:
fetch-depth: 0
- name: Git checkout (PR)
uses: actions/checkout@v3
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
# see: https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout
ref: ${{ github.event.pull_request.head.sha }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
cache: 'sbt'
- name: Cache node_modules
uses: actions/cache@v3
with:
path: |
~/.npm
~/.nvm
~/work/scommons-react/scommons-react/core/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/core/target/scala-2.13/scalajs-bundler/test/package-lock.json
~/work/scommons-react/scommons-react/dom/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/dom/target/scala-2.13/scalajs-bundler/test/package-lock.json
~/work/scommons-react/scommons-react/redux/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/redux/target/scala-2.13/scalajs-bundler/test/package-lock.json
~/work/scommons-react/scommons-react/showcase/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/showcase/target/scala-2.13/scalajs-bundler/test/package-lock.json
~/work/scommons-react/scommons-react/test/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/test/target/scala-2.13/scalajs-bundler/test/package-lock.json
~/work/scommons-react/scommons-react/test-dom/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/test-dom/target/scala-2.13/scalajs-bundler/test/package-lock.json
key: ${{ runner.os }}-node_modules-cache-v3-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules-cache-v3-
- name: Extract Tag Name
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
if: ${{ startsWith(github.ref, 'refs/tags') }}
- name: Run tests
run: |
sbt coverage test
sbt coverageAggregate coveralls
if: ${{ env.TAG_NAME == '' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
- name: Publish SNAPSHOT
run: sbt clean publish
if: ${{ !github.event.pull_request && env.TAG_NAME == '' }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
- name: Publish RELEASE
run: |
mkdir ./keys
echo $PGP_PUBLIC | base64 --decode > ./keys/pubring.gpg
echo $PGP_SECRET | base64 --decode > ./keys/secring.gpg
VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)"
echo "Publish a release version=$VERSION for tag $TAG_NAME"
version=$VERSION sbt clean publishSigned sonatypeBundleRelease
if: ${{ env.TAG_NAME != '' }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_PUBLIC: ${{ secrets.PGP_PUBLIC }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASS: ${{ secrets.PGP_PASS }}