name: Publish

permissions: read-all

on:
  workflow_dispatch:
  push:
    tags:
      - '*v*'

jobs:
  npm-publish:
    name: Publish npm packages
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - name: Check out repository
        uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        with:
          fetch-depth: 2
      - name: Set npm registry
        run: npm config set registry 'https://wombat-dressing-room.appspot.com/'
      - name: Publish packages
        env:
          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN_RELEASE}}
        run: |
          npm config set '//wombat-dressing-room.appspot.com/:_authToken' $NODE_AUTH_TOKEN
          npm publish
