CI Sidebar SDK JS #556
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI Sidebar SDK JS | |
on: | |
push: | |
branches: [main] | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: [main] | |
schedule: | |
- cron: "0 2 * * *" # Everyday at 2:00AM | |
workflow_dispatch: | |
inputs: | |
reason: | |
description: "Trigger Comment (Optional)" | |
required: false | |
default: "Manual Workflow Run" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: 'https://registry.npmjs.org' | |
- name: Setup SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
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 | |
# npm version patch -m "Release version %s" -f | |
- name: Archive artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: dist | |
path: | | |
dist/**/* | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v2 | |
with: | |
name: code-coverage-report | |
path: tmp/reports/coverage/**/cobertura-coverage.xml | |
- name: Publish to NPM | |
id: publish | |
uses: JS-DevTools/npm-publish@v1 | |
if: github.ref == 'refs/heads/main' | |
with: | |
token: ${{ secrets.NPM_ACCESS_TOKEN }} | |
- name: Push tag | |
uses: anothrNick/[email protected] | |
if: github.ref == 'refs/heads/main' && steps.publish.outcome == 'success' && steps.publish.outputs.type != 'none' | |
env: | |
CUSTOM_TAG: v${{ steps.publish.outputs.version }} | |
- name: Publish github pages 🚀 | |
if: github.ref == 'refs/heads/main' && steps.publish.outcome == 'success' && steps.publish.outputs.type != 'none' | |
uses: JamesIves/[email protected] | |
with: | |
branch: gh-pages | |
folder: docs | |