name: Publish

on:
  push:
    branches:
      - next-release
      - release/*
env:
  CI: true

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
  cancel-in-progress: true

jobs:
  version:
    timeout-minutes: 15

    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [ubuntu-latest]
        node: [18]

    steps:
      - name: Checkout 🛎
        uses: actions/checkout@master

      - name: Setup node env 🏗
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node }}
          check-latest: true

      #- name: Setup npmrc 🏗
      #  run: echo "\n//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc

      - name: Install Dependencies 👨🏻‍💻
        uses: ./.github/actions/install-dependencies

      - name: Bump versions 🏷 and Publish 🚀
        uses: changesets/action@v1
        with:
          version: pnpm ci:version
          commit: "chore: bump versions"
          title: "chore: bump versions"
          # manual publish currently
          # publish: pnpm ci:publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
