Release v0.4.2 #135
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 | |
on: | |
- push | |
env: | |
NODE_VERSION_FOR_PUBLISH: "20" | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node: | |
- "18" | |
- "20" | |
- "22" | |
env: | |
# Reduce ANSI terminal output for webpack and Cypress | |
NO_COLOR: 1 | |
steps: | |
- name: Checkout git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Cache ~/.npm for Node ${{ matrix.node }} | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ matrix.node }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ matrix.node }}-npm- | |
- name: Cache ~/.cache/Cypress for Node ${{ matrix.node }} | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/Cypress | |
key: ${{ runner.os }}-node-${{ matrix.node }}-cypress-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ matrix.node }}-cypress- | |
- name: Install npm dependencies | |
run: npm ci | |
- name: Verify Cypress installation | |
run: ./node_modules/.bin/cypress verify | |
- name: Run tests | |
run: npm test | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
if: github.ref_type == 'tag' && startsWith(github.ref_name, 'v') | |
steps: | |
- name: Checkout git repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
- name: Setup node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION_FOR_PUBLISH }} | |
registry-url: https://registry.npmjs.org | |
- name: Cache ~/.npm for Node ${{ env.NODE_VERSION_FOR_PUBLISH }} | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ env.NODE_VERSION_FOR_PUBLISH }}-npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ env.NODE_VERSION_FOR_PUBLISH }}-npm- | |
- name: Install npm dependencies | |
run: npm ci | |
- name: Check that git tag and npm package version match | |
run: | | |
npm_package_version=$(node --eval 'console.log(require("./package.json").version)') | |
git_tag_version="${GITHUB_REF_NAME:1}" | |
if [[ "$npm_package_version" != "$git_tag_version" ]]; then | |
echo "::error::npm package version and git tag differ: npm_package_version=$npm_package_version git_tag_version=$git_tag_version" >&2 | |
false | |
fi | |
- name: Publish npm package | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |