name: Release

on:
  push:
    branches:
      - master

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
  release:
    name: Release new version
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          token: ${{ secrets.READ_AND_WRITE_TOKEN }}

      - uses: actions/setup-node@v4
        with:
          node-version-file: '.nvmrc'

      - run: npm ci

      - name: Create release pull request
        uses: changesets/action@v1
        with:
          publish: npm run tag
        env:
          GITHUB_TOKEN: ${{ secrets.READ_AND_WRITE_TOKEN }}