-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (69 loc) · 1.85 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
name: Release to NPM
on:
pull_request: {}
push:
branches:
- main
permissions:
contents: write
pull-requests: write
issues: write
jobs:
commitlint:
name: Lint commit messages
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: latest
- run: npm ci
# Hiding tsconfig.json to workaround
# https://github.com/conventional-changelog/commitlint/issues/3256
- run: mv tsconfig.json tsconfig.json.nope
- name: commitlint
run: |
npx commitlint \
--from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} \
--to ${{ github.event.pull_request.head.sha }} \
--verbose
- run: mv tsconfig.json.nope tsconfig.json
publish:
name: Publish to NPM
needs: ci
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- run: npm run build
- run: npm audit signatures
- run: npx semantic-release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
ci:
needs: lint
runs-on: ubuntu-latest
if: ${{ !cancelled() }}
steps:
- run: if [ "${{ needs.lint.result }}" != "success" ]; then exit 1; fi
lint:
name: Lint code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm run format:check