Skip to content

let some tolerance through... #3

let some tolerance through...

let some tolerance through... #3

name: Test and release
on:
push:
pull_request:
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- id: checkout
name: Checkout repository
uses: actions/checkout@v3
- id: setup-pnpm
name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- id: setup-node
name: Setup Node.JS
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- id: install-deps
name: Install dependencies
run: pnpm install --frozen-lockfile
- id: lint
name: Lint code
run: pnpm eslint ./src/ --ext .ts --debug
test:
name: Test
runs-on: ubuntu-latest
needs: lint
strategy:
matrix:
node-version: ['20']
steps:
- id: checkout
name: Checkout repository
uses: actions/checkout@v3
- id: setup-pnpm
name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- id: setup-node
name: Setup Node.JS
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- id: install-deps
name: Install dependencies
run: pnpm install --frozen-lockfile
- id: tests
name: Run tests
run: pnpm run test
release:
name: Release
runs-on: ubuntu-latest
needs: test
permissions:
contents: write
# Restricts release to:
# 1) pushes of release tags
# 2) the default branch
# 3) the base repository
if: |
github.event_name == 'push' && startsWith(github.ref, 'refs/tags') &&
endsWith(github.event.base_ref, github.event.repository.default_branch) &&
github.repository == 'reuters-graphics/paparazzo'
steps:
- id: checkout
name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.repository.default_branch }}
- id: setup-pnpm
name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8
- id: setup-node
name: Setup Node.JS
uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://registry.npmjs.org
scope: '@reuters-graphics'
- id: install-deps
name: Install dependencies
run: pnpm install --frozen-lockfile
- id: build
name: Build package
run: pnpm build
- id: build-docs
name: Build docs
run: pnpm docs:build
- id: version
name: Version
run: npm version ${{ github.ref_name }} --no-git-tag-version
- id: publish
name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- id: commit
name: Commit
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -am "published ${{ github.ref_name }}"
git push