-
Notifications
You must be signed in to change notification settings - Fork 15
98 lines (92 loc) · 2.74 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
name: ci
on:
push:
branches: [main]
tags: ['v*.*.*']
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
version:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Version
uses: sergeysova/jq-action@v2
id: version
with:
cmd: 'jq --raw-output .version package.json'
- name: Check
run: |
_version_package="v${{ steps.version.outputs.value }}"
_version_git="${{ github.ref_name }}"
if [ ! "$_version_package" = "$_version_git" ]; then
printf "[ERROR]: Versions do not match --> 'package.json %s' != 'git tag %s'\n" "$_version_package" "$_version_git"
exit 1
fi
ci:
needs: version
if: always() && (needs.version.result == 'success' || needs.version.result == 'skipped')
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
node-version: [18.x, 20.x, 22.x]
fail-fast: true
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Check
run: npm run check
- name: Build
run: npm run build
- name: Test
run: npm run test:ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
runs-on: ubuntu-latest
needs: ci
if: startsWith(github.ref, 'refs/tags/') && needs.ci.result == 'success'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Build Changelog
id: changelog
uses: mikepenz/release-changelog-builder-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
configuration: './.github/configs/changelog.json'
owner: gunar
repo: shellcheck
failOnError: true
- name: Release
uses: softprops/action-gh-release@v1
with:
body: ${{ steps.changelog.outputs.changelog }}
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}