flexper/rosetty

View on GitHub
.github/workflows/publish.yml

Summary

Maintainability
Test Coverage
name: publish
on:
  pull_request:
    branches:
      - master
    types: [closed]

jobs:
  build:
    name: Build, lint, and test on Node ${{ matrix.node }} and ${{ matrix.os }}

    if: startsWith(github.head_ref, 'renovate/')
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        node: ["16.x"]
        os: [ubuntu-latest]

    steps:
      - uses: dorny/paths-filter@v3
        id: changes
        with:
          filters: |
            src:
              - 'src/**'
              - 'package.json'
              - 'pnpm-lock.yaml'
      - name: Checkout repo
        if: steps.changes.outputs.src == 'true'
        uses: actions/checkout@v4

      - if: steps.changes.outputs.src == 'true'
        run: |
          git config user.name "${{ secrets.USER_NAME }}"
          git config user.email "${{ secrets.USER_EMAIL }}"

      - name: Use Node ${{ matrix.node }}
        if: steps.changes.outputs.src == 'true'
        uses: actions/setup-node@v4
        with:
          node-version: ${{ matrix.node }}

      - name: Install PNPM
        if: steps.changes.outputs.src == 'true'
        uses: pnpm/action-setup@v4.0.0
        with:
          version: 6.0.2

      - name: Install deps and build (with cache)
        if: steps.changes.outputs.src == 'true'
        run: pnpm install --no-frozen-lockfile

      - name: Lint
        if: steps.changes.outputs.src == 'true'
        run: pnpm lint

      - name: Test
        if: steps.changes.outputs.src == 'true'
        run: pnpm test -- --ci --coverage --maxWorkers=2

      - name: Build
        if: steps.changes.outputs.src == 'true'
        run: pnpm build

      - name: Bump version
        if: steps.changes.outputs.src == 'true'
        uses: qzb/standard-version-action@v1.0.13



      - if: steps.changes.outputs.src == 'true'
        run: |
          git config --global user.name "${{ secrets.USER_NAME }}"
          git config --global user.email "${{ secrets.USER_EMAIL }}"
          git push --follow-tags origin master

      - if: steps.changes.outputs.src == 'true'
        uses: JS-DevTools/npm-publish@v3
        with:
          token: ${{ secrets.NPM_TOKEN }}