on:
    push:
        branches:
            - main

permissions:
    contents: write
    pull-requests: write
    id-token: write # Required for OIDC

name: Versioning

jobs:
    release-please:
        name: Release Please
        runs-on: ubuntu-latest
        steps:
            - uses: google-github-actions/release-please-action@v3
              with:
                  release-type: node
                  package-name: pip-requirements-js
    publish:
        if: "startsWith(github.event.head_commit.message, 'chore(main): release')"
        name: Publish
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v4
            - uses: pnpm/action-setup@v4
            - uses: actions/setup-node@v4
              with:
                  cache: 'pnpm'
                  registry-url: 'https://registry.npmjs.org'
            - run: pnpm install
            - run: pnpx npm publish
