-
Notifications
You must be signed in to change notification settings - Fork 3
64 lines (59 loc) · 1.85 KB
/
ci.yaml
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
name: test & publish
on:
push:
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
sentencecase: ['on+guess', 'on', 'off']
caseprotection: [ 'as-needed', 'strict', 'off' ]
preservequoted: [ 'false', 'true' ]
steps:
- uses: actions/checkout@v3
- run: echo "::version="`jq -r .version package.json` >> $GITHUB_OUTPUT
id: version
- name: cancel spurious build on tagged version
uses: andymckay/cancel-action@master
if: github.event.head_commit.message == steps.version.outputs.version && !startsWith(github.ref, 'refs/tags/')
- name: install node
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Cache node dependencies
uses: actions/cache@v3
env:
cache-name: cache-dependencies
with:
path: |
~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
- name: install node dependencies
run: npm install
- run: npm test --sentence-case=${{ matrix.sentencecase }} --case-protection=${{ matrix.caseprotection }} --preserve-quoted=${{ matrix.preservequoted }} --big
release:
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v3
- name: install node
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Cache node dependencies
uses: actions/cache@v2
env:
cache-name: cache-dependencies
with:
path: |
~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
- name: install node dependencies
run: npm install
- name: Publish
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
access: public