-
-
Notifications
You must be signed in to change notification settings - Fork 6
110 lines (83 loc) · 2.49 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
100
101
102
103
104
105
106
107
108
109
110
name: CI
on: push
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 19, 20, 21]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true
- name: Install dependencies
run: npm ci
- name: Prettier
run: npm run prettier
- name: ESLint
run: npm run eslint
- name: Commitlint
run: npm run commitlint
- name: Tests
run: npm test
- name: Publish (test)
run: npm publish --dry-run
- name: Docs
run: npm run docs:build
- name: Coverage
run: npm run coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: Node.js v${{ matrix.node-version }}
parallel: true
coverage:
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
release:
if: ${{ github.ref == 'refs/heads/main' }}
needs: [test, coverage]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
- name: Import GPG key
run: echo $GPG_KEY | base64 --decode | gpg --batch --import
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
- name: Add the custom gpg executable
run: |
rm -rf /tmp/gpg.sh
echo 'gpg --batch --pinentry-mode=loopback --passphrase $GPG_KEY_PASSPHRASE $@' >> /tmp/gpg.sh
chmod +x /tmp/gpg.sh
- name: Setup git
run: |
git config commit.gpgsign true
git config user.signingkey $GPG_KEY_ID
git config gpg.program /tmp/gpg.sh
env:
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
- name: Install dependencies
run: npm ci
- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
GPG_KEY_PASSPHRASE: ${{ secrets.GPG_KEY_PASSPHRASE }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}