name: Release
on:
  push:
    tags:
      - '[0-9]+.[0-9]+.[0-9]+'

permissions:
  id-token: write  # Required for OIDC
  contents: read

jobs:
  release:
    runs-on: ubuntu-latest
    environment: release
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
          registry-url: 'https://registry.npmjs.org'
      # Ensure npm 11.5.1 or later is installed
      - name: Update npm
        run: npm install -g npm@latest
      - run: npm ci
      - run: npm run lint:fail-on-warnings
      - run: npm publish

      - name: Documentation
        run: npm run doc:deploy
