name: Release

on:
  release:
    types: [published]

jobs:
  setup:
    runs-on: ubuntu-latest
    name: Build and publish MathJax
    permissions:
      contents: read
      id-token: write
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - uses: pnpm/action-setup@v4
        name: Install pnpm
        with:
          version: 10
          run_install: false
          registry-url: 'https://registry.npmjs.org'
        
      - name: Temp fix to publish
        run: |
          echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
          echo "always-auth=true" >> ~/.npmrc

      - name: Publish to npmjs
        run: pnpm publish --access public --no-git-checks
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

