name: Release
on:
  push:
    branches:
      - main
    paths:
      - 'packages/**'
      - '!packages/config-eslint/**'
      - '.changeset/**'

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

env:
  CI: true

jobs:
  version:
    timeout-minutes: 15
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@v3

      - name: setup node.js 20
        uses: actions/setup-node@v3
        with:
          node-version: 20

      - name: install pnpm
        run: npm i pnpm@latest -g

      - name: install dependencies
        run: pnpm install

      - name: create and publish versions
        uses: changesets/action@v1
        with:
          publish: pnpm ci:publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
