# This is a basic workflow that is manually triggered

name: Manual workflow

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  npm_publish:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [ 18.x ]
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ matrix.node-version }}
          registry-url: 'https://npm.pkg.github.com'
      - run: yarn
      - name: Run yarn build
        run: |
          yarn build
      - name: Configure git.vdb.to npm registry
        run: |
          npm config set @cerc-io:registry https://git.vdb.to/api/packages/cerc-io/npm/
      - name: Authenticate to git.vdb.to registry
        run: |
          npm config set -- '//git.vdb.to/api/packages/cerc-io/npm/:_authToken' "${{ secrets.GITEA_PUBLISH_TOKEN }}"
      - name: lerna publish
        run: |
          yarn lerna publish from-package --no-git-tag-version --yes
