Skip to content

4.2.2-provenance-test.0 #935

4.2.2-provenance-test.0

4.2.2-provenance-test.0 #935

Workflow file for this run

name: CI
on: [push, pull_request]
jobs:
build:
name: Build & test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 22.x, v22.20.0, '*']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
check-latest: true
cache: 'npm'
cache-dependency-path: 'package.json'
- run: npm install
- run: npm run ci-tests
env:
# Node v22+ needs no strip-types (because we use ts-node for full TS instead)
NODE_OPTIONS: >-
${{ (!startsWith(matrix.node-version, '20') && '--no-experimental-strip-types') || '' }}
# We log performance test results to Posthog to track trends:
POSTHOG_PERF_API_KEY: ${{ secrets.POSTHOG_PERF_API_KEY }}
- name: Deploy docs
if: github.ref == 'refs/heads/main' && matrix.node-version == 'v22.20.0'
uses: JamesIves/github-pages-deploy-action@v4
with:
single-commit: true
branch: gh-pages
folder: typedoc
publish:
name: Publish to npm
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment:
name: npm
url: https://www.npmjs.com/package/mockttp
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 'v22.20.0'
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: 'package.json'
- run: npm install
- run: npm run build
- name: Verify tag matches package.json version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
PACKAGE_VERSION=$(node -p "require('./package.json').version")
if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "Error: Tag version (v$TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)"
exit 1
fi
echo "✓ Tag version matches package.json version: $PACKAGE_VERSION"
- run: npm publish