1.1.2 #86
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: Node.js CI | |
on: | |
push: | |
branches: [ main ] | |
tags: [ v* ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: textbook/take-action@nodejs | |
with: | |
node-version: 18 | |
- run: npm run lint | |
- run: npm run test:coverage | |
- uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: coverage-report | |
path: reports | |
- run: npm run test:mutation -- --reporters=clear-text,dots | |
- run: npm run build | |
- run: npm pack | |
- run: mv textbook-build-info-*.tgz package.tgz | |
- uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: error | |
name: package | |
path: package.tgz | |
quality: | |
needs: [ test ] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: textbook/take-action@nodejs | |
with: | |
checkout: false | |
node-version: 18 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: coverage-report | |
path: reports | |
- uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
e2e: | |
strategy: | |
matrix: | |
platform: [ ubuntu-22.04 ] | |
node: [ 18.3, 18, 20 ] | |
include: | |
- node: 18 | |
platform: windows-2022 | |
needs: [ test ] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: package | |
- run: npm init --yes | |
- run: npm install package.tgz | |
- run: npx buildinfo -o out.txt | |
- run: npx buildinfo --output out.txt | |
- run: npx buildinfo > out.txt | |
- run: type out.txt | |
if: contains(matrix.platform, 'windows') | |
- run: cat out.txt | |
if: contains(matrix.platform, 'ubuntu') | |
deploy-github: | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [ e2e ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: package | |
- run: | | |
gh release create \ | |
'${{ github.ref_name }}' \ | |
--title '${{ github.ref_name }}' \ | |
"package.tgz#NPM package" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
deploy-npm: | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/v') | |
environment: npm | |
needs: [ e2e ] | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: package | |
- run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_AUTH_TOKEN}" | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
- run: npm publish --provenance package.tgz |