Skip to content

0.4.0

0.4.0 #8

Workflow file for this run

name: CI
on:
push:
branches: [ $default-branch, master ]
tags:
- '*'
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
setup:
name: Setup environment
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json') }}
- name: Install dependencies
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
test:
name: Test
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Load node_modules from cache
uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json') }}
- name: Unit tests
run: npm test -- --coverage
- name: Linter
run: npm run lint
- name: Build
run: npm run build
- name: Cache dist
uses: actions/cache@v3
with:
path: dist/
key: ${{ runner.os }}-dist-${{ github.sha }}
publish:
if: github.event_name == 'push' && contains(github.ref, '/tags/v')
name: Publish to npm
needs: test
runs-on: ubuntu-latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Load node_modules from cache
uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json') }}
- name: Load dist from cache
uses: actions/cache@v3
with:
path: dist/
key: ${{ runner.os }}-dist-${{ github.sha }}
- name: Create npmrc file
run: echo "//registry.npmjs.org/:_authToken=\${NODE_AUTH_TOKEN}" >> $HOME/.npmrc 2> /dev/null
- run: npm publish
release:
if: github.event_name == 'push' && contains(github.ref, '/tags/v')
name: Github release
needs: publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Load node_modules from cache
uses: actions/cache@v3
with:
path: |
node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('package.json') }}
- name: Extract tmp current changelog
run: node utils/extractChangelog.mjs
- name: Create release
uses: softprops/action-gh-release@v1
with:
body_path: current-changelog.txt