-
Notifications
You must be signed in to change notification settings - Fork 3
88 lines (74 loc) · 2.4 KB
/
build.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
name: CI Sidebar SDK JS
on:
push:
branches: [main]
tags:
- "v*.*.*"
pull_request:
branches: [main]
schedule:
- cron: "0 2 * * *"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: Setup SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@v3
with:
args: -Dsonar.organization=acrolinx
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
- name: Setup and Audit Source Code
run: |
npm ci
npm audit --production --audit-level=moderate
- name: Check for suitable licenses
run: |
export v=`node -p "require('./package.json').version"`
export n=`node -p "require('./package.json').name"`
npx license-checker --production --onlyAllow 'BSD;CC-PDDC;CC-BY-3.0;CC-BY-1.0;CC-BY-2.0;CC-BY-4.0;CC0-1.0;Apache;Artistic;MIT;MPL;ISC;Unlicense' --excludePackages "$n@$v$LICENSE_EXCLUDED_PACKAGES" --excludePrivatePackages
- run: npm ci
- run: npm run lint
- run: |
npm run build
npm run buildDoc
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/**/*
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: tmp/reports/coverage/**/cobertura-coverage.xml
- name: Publish to NPM
id: publish
uses: JS-DevTools/npm-publish@v3
if: github.ref == 'refs/heads/main'
with:
token: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Push tag
uses: anothrNick/github-tag-action@v1
if: github.ref == 'refs/heads/main' && steps.publish.outputs.type
env:
CUSTOM_TAG: v${{ steps.publish.outputs.version }}
- name: Publish github pages 🚀
if: github.ref == 'refs/heads/main' && steps.publish.outputs.type
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: docs