-
Notifications
You must be signed in to change notification settings - Fork 3
65 lines (60 loc) · 1.88 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
65
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@v4
- 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@v4
with:
node-version: 20.x
- name: Cache node dependencies
uses: actions/cache@v4
env:
cache-name: cache-dependencies
with:
path: |
~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('package-lock.json') }}
- run: |
npm install
echo '{"sentenceCase": "${{ matrix.sentencecase }}", "caseProtection": "${{ matrix.caseprotection }}", "preserveQuoted": ${{ matrix.preservequoted }}, "big": true}' > test/runtests.json
npm test -- --color
release:
runs-on: ubuntu-latest
needs: test
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: install node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Cache node dependencies
uses: actions/cache@v4
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